How to filter a list with a variable anywhere in a line

Mark Wieder ahsoftware at sonic.net
Mon Aug 13 11:38:45 EDT 2018


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




More information about the use-livecode mailing list