Problems with Filter?

Mark Wieder ahsoftware at sonic.net
Sat Mar 12 14:05:01 EST 2022


On 3/12/22 08:43, Rick Harrison via use-livecode wrote:
> Good Morning!
> 
> I’m trying to get filter to work with some text and so far no success at all.
> 
> Given large string:  abcdefghijkTHISISMYTEXTTOFINDlmnopqrstuvwxyz
> 
> I want the text between THIS and FIND which could be anything like ISLJFKKDKLS
> 
> It’s OK to include the THIS and FIND in my result.
> 
> I’m thinking I need a wildcard character like * to get the information.
> 
> 
> So if I try:
> put "THIS*FIND" into tTarget
> 
> put “abcdefghijkTHISISMYTEXTTOFINDlmnopqrstuvwxyz” into tLargeTextString
> 
> put tLargeTextString into pText
> 
> filter pText with regex tTarget into tFilteredTextResult
> 
> answer "tFilteredTextResult = " & tFilteredTextResult
> 
> One might think this would work, but it doesn’t, and I get nothing for tFilteredTextResult
> 
> Suggestions?

Try matchtext rather than filter:

local tTextt, tFound?
put matchtext(tLargeTextString, ".*THIS(.*)FIND.*", tText) into tFound?

-- 
  Mark Wieder
  ahsoftware at gmail.com



More information about the use-livecode mailing list