Hi Richard et al,

My day-job got in the way these past few weeks; half of my team was on holiday 
and another member just had a new daughter to celebrate.
Needless to say I've been plugging all the holes there and didn't have time to 
do the next set of changes to the 'filter' command.

At any rate, for those of you who haven't been following the engine 
contributors forum, here's what is ready to go in the next functional release:
- filtering items (in addition to lines)
- regular expression matching (in addition to wildcard matching)
- placing the output of the filter into a separate container

Don't worry, these additions were implemented in a backward-compatible way :-)

The above comes together in the following extended syntax:
filter  [ { lines | items }of ] <containerOrExpression> { with | without | [ 
not ] matching } [ { wildcard | regex } [ pattern ] ] <patternExpression> [ 
into <targetContainer> ]

That looks intimidating, so here are a few examples:

filter tList with "A*" -- lines which begin with "A"
filter tList without empty -- remove all empty lines
filter items of tCommaSeparatedList with "A*" -- now you can filter items in 
addition to lines
filter lines of tList matching regex pattern "A.*" -- now you have the full 
power of regular expressions
filter tOriginalList with "A*" into tFilteredList -- now you can direct the 
output to a different container

That's done, so what's next once I find the time? -> filter by expression

filter lines of tList where each begins with "A" and each ends with "Z"
filter items of tList where word 2 of each contains "123" or char 3 of each is 
in "abcd"
filter tList by MyLogicalFunction(each)

That's the beauty of open source: now we can add features to the engine if we 
pull up our sleeves...

Cheers,

Jan Schenkel.

=====
Quartam Reports & PDF Library for LiveCode
www.quartam.com


=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La 
Rochefoucauld)


>________________________________
> From: Dr. Hawkins <[email protected]>
>To: How to use LiveCode <[email protected]> 
>Sent: Monday, August 26, 2013 7:42 PM
>Subject: multiple arguments for filter?
> 
>
>I thought I had seen references here to using OR with filter (on a container).
>
>Is there a way to do this; I can't find it in the docs, and my
>experiment failed.
>
>At the moment, I'm looping around with a repeat and a switch for the
>regexps.  It's not a performance section of the code, but it's *so*
>ugly, and unmaintainable . . .
>
>-- 
>Dr. Richard E. Hawkins, Esq.
>(702) 508-8462
>
>_______________________________________________
>use-livecode mailing list
>[email protected]
>Please visit this url to subscribe, unsubscribe and manage your subscription 
>preferences:
>http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
>
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to