How to filter a list with a variable anywhere in a line
Keith Clarke
keith.clarke at me.com
Mon Aug 13 11:51:15 EDT 2018
Thanks Mark - that fixed it (as in, the simpler approach of dropping the brackets).
Being ‘regex-phobic', I hadn’t picked up the subtle difference between wildcards and ‘formal’ regex in the doc examples. ;-)
Thanks & regards,
Keith
> On 13 Aug 2018, at 16:38, Mark Wieder via use-livecode <use-livecode at lists.runrev.com> wrote:
>
> On 08/13/2018 08:32 AM, Keith Clarke via use-livecode wrote:
>> Folks,
>> I’m trying to filter a list of comma-delimited values to include only the lines that contain a string - somewhere in any of the items.
>> What’s wrong with this syntax - it’s currently returning no lines when I can see tString in the second line of the variable?
>> filter lines of tList with "*[" & tString & "]*"
>> I’m guessing my concatenation fails to create good regex?
>
> If you really want regex then you have to specify that explictly:
>
> filter lines of tList with regex pattern "*[" & tString & "]*"
>
> but my guess is what you want is just
>
> filter lines of tList with "*" & tString & "*"
>
> --
> Mark Wieder
> ahsoftware at gmail.com
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list