Secrets of the filter command?

Jim Ault JimAultWins at yahoo.com
Tue Jun 26 19:54:22 EDT 2007


In the Regular Expression world the square brackets mean "consider the next
char = [a-z] as a hit if it is lowercase a through z, thus
[a-zA-Z] => lower and uppercase rule for a *single* character.

[$£] means true if the char is either "$" or "£"
filter productName with "*[Rr]ev*"
--> means filter if lower or upper R  (see examples below)
careful when considering:

filter ("rev & cr & "Rev" & cr & "cat") with "*r*" => both lines
filter ("rev & cr & "Rev" & cr & "cat") with "*[r]*" => "rev"
filter ("rev & cr & "Rev" & cr & "cat") with "*[R]*" => "Rev"
filter ("rev & cr & "Rev" & cr & "cat") with "*[rR]*" =>both lines
--
--in the multi-line msg box you could do the following 3 lines to test

get ("rev & cr & "Rev" & cr & "cat")
filter it with "*[r]*"
put it into msg

--now change line 2 to see the difference

--you can do debugging & more complex lists by

get the clipboarddata
filter it with "*[r]*"
put it into msg


filter it with "*[r][e][v]*" => "rev" is in the line somewhere
filter it with "*[R][E][V]*" => "REV" is in the line somewhere
filter it with "[R][E][V]*" => line must start with "REV"
filter it with "[R][E][V]" => line must be exactly "REV"
filter it with "*[R][E][V]" => line must end with "REV"
filter it with "*rev" => line must end with "rev" upper or lower chars

This can get you started.
The more rules you add, the more CPU cycles required.
The closer to the beginning of the line a hit is found, the faster the
filter/RegEx commands will work.

I use very simple patterns so I don't know all the variations or where to
find them.

Jim Ault
Las Vegas


On 6/26/07 11:58 AM, "David Bovill" <david at openpartnership.net> wrote:

> I've always been curious about the filter command - and I am pretty sure
> from examples I have seen that there is a lot more to it than is shown in
> the docs.
> 
> Take this example from Jerry Daniels beautiful Galaxy:
> 
> filter someScript with "[-ofsgOFSG][-nueNUE][> ntNT]*"
> 
> 
> What is the leading "-" doing or the "> " ???
> 
> Does anyone know what the underlying mechanism to it is - and are there any
> links to a fuller documentation?
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution





More information about the use-livecode mailing list