Weirdness with filter (maybe?)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Weirdness with filter (maybe?)

Mike Kerner via use-livecode
I have a return-delimited list. Each line of this list consists of [some text] & tab & [other text]. I want to see all the lines of the list for which [some text] contains Character String X. This is obviously a job for the filter command, right? So I try this:

filter lines of MyList with ("*" & CharStringX & "*" & tab)

The result I'm expecting is, a list which contains every line of MyList in which the [some text] bit contains CharStringX.

The result I get is, a "list" which contains zero lines.

Have tried various alternate forms of the line, including…

filter lines of MyList with ("*" & CharStringX & "*" & numToChar (9))
filter lines of MyList with wildcard pattern ("*" & CharStringX & "*" & tab)
filter lines of MyList matching wildcard pattern ("*" & CharStringX & "*" & tab)

…all of which yield the same results as the original line.

Would appreciate a sanity check: Am I missing some necessary part of the filter syntax? Does the filter command even know what to do with the constant "tab"? How *does* one filter for a pattern that includes a tab?

   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"
   
Read the webcomic at [ http://www.atarmslength.net ]!
   
If you like "At Arm's Length", support it at [ http://www.patreon.com/DarkwingDude ].

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Weirdness with filter (maybe?)

Mike Kerner via use-livecode
I think it should be

  filter lines of MyList with (charStringX & TAB & *)

i.e. get lines containing this string X followed by TAB followed by anything

Alex

On 20/04/2017 09:22, Quentin Long via use-livecode wrote:

> I have a return-delimited list. Each line of this list consists of [some text] & tab & [other text]. I want to see all the lines of the list for which [some text] contains Character String X. This is obviously a job for the filter command, right? So I try this:
>
> filter lines of MyList with ("*" & CharStringX & "*" & tab)
>
> The result I'm expecting is, a list which contains every line of MyList in which the [some text] bit contains CharStringX.
>
> The result I get is, a "list" which contains zero lines.
>
> Have tried various alternate forms of the line, including…
>
> filter lines of MyList with ("*" & CharStringX & "*" & numToChar (9))
> filter lines of MyList with wildcard pattern ("*" & CharStringX & "*" & tab)
> filter lines of MyList matching wildcard pattern ("*" & CharStringX & "*" & tab)
>
> …all of which yield the same results as the original line.
>
> Would appreciate a sanity check: Am I missing some necessary part of the filter syntax? Does the filter command even know what to do with the constant "tab"? How *does* one filter for a pattern that includes a tab?
>
>    
> "Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"
>      
> Read the webcomic at [ http://www.atarmslength.net ]!
>      
> If you like "At Arm's Length", support it at [ http://www.patreon.com/DarkwingDude ].
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode