I am not an expert in regex or filtering by any means so Quentin’s message 
prompted me to take a closer look. I started with the dictionary entry for 
filter and I found this simple example:
filter items of "apple,banana,cherry" with regex pattern "b.*"

Since we are not specifying a destination, the result is going into the “it" 
variable. I tried that and got the expected result “banana”. Next I tried “c.*” 
and got cherry and “d.*’ and got nothing. All good. Finally I tried “a.*” and 
got “apple, banana”. I was a bit surprised by that. Does anyone know why “a.*” 
breaks the pattern of returning a single item? Does it have something to do 
with the item being in the first position in the string? 

BTW, I did try putting the result into a variable and displaying that (… into 
temp; put temp) and got the same result. 

Also, I thought I might try a few experiments using “without regex pattern” and 
using “a.*” as the argument returned “cherry” so at least whatever it is doing 
it is consistent.

Mark


> On Mar 7, 2022, at 8:58 AM, Quentin Long via use-livecode 
> <use-livecode@lists.runrev.com> wrote:
> 
> sez j. landman gay:
>> Interesting idea. There are 25 letters on each board, some are always 
>> repeats. I think I'd need 
>> a good regex so I wouldn't have to run the filter command multiple times. 
>> How's your regex?
> 
> I see you've already implemented something, but just for grins, here's my 
> thought re: the One True Regex for this situation:
> AbsentChars is the name of a variable which contains all the letters that 
> *aren't* on the board. My first attempt at the regex is…
> filter lines of WordList without "*[AbsentChars]*"
> However, that will remove all words that contain at least one letter in the 
> specific character string "absentchars", which is not what I want. So, bring 
> out the "do" keyword…
> do ("filter lines of WordList without" && quote & "*" & AbsentChars & "*" & 
> quote)
> 
> "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
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

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

Reply via email to