Re: Filter with wildcards
Users should certainly never see regex! That’s covered in User Interface Guidelines 101. But surely you wouldn’t show them the LC wildcard filter either! $@%?$@%?$@%?$@%?$@%?$@%?$@%?$@%? Neville Smythe Director, International Go Federation VicePresident, Australian Go Association Inc. > On 3 Nov 2023, at 12:02 am, David Glasgow wrote: > > > >> On 1 Nov 2023, at 11:24 pm, Neville Smythe >> wrote: >> >> But I suspect you should allow for the required strings to be followed by >> punctuation or be at the end of the line, things which are hard to do with a >> simple LC wildcard search, at least in a single filter. > > > When I originally went down the wildcard route, I wrote some gentle text > preprocessing (using replace) to make sure words are always bounded by a > space, including before punctuation and at an eol. > > I also need users to see the reason the message appears in the results (i.e > the matched filter) so they are listed under a heading consisting of the > search term. Not sure what users would make of regex! > > Thanks again, > > Cheers > > David G ___ 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
Re: Filter with wildcards
> On 1 Nov 2023, at 11:24 pm, Neville Smythe > wrote: > > But I suspect you should allow for the required strings to be followed by > punctuation or be at the end of the line, things which are hard to do with a > simple LC wildcard search, at least in a single filter. When I originally went down the wildcard route, I wrote some gentle text preprocessing (using replace) to make sure words are always bounded by a space, including before punctuation and at an eol. I also need users to see the reason the message appears in the results (i.e the matched filter) so they are listed under a heading consisting of the search term. Not sure what users would make of regex! Thanks again, Cheers David G ___ 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
Re: Filter with wildcards
I agree David, regular expressions look intimidating at first sight. But in fact if you compare your intuitive attempt filter tList with “*with [you,u] *” with the regex which does what you set out to do filter tList with regex “.*with (you|u) .*” they are almost exactly the same – for very good reasons of course. The . is just the regex for a single character, the * says “any number incuding 0 of the preceding pattern”. I don’t know your actual use-case, the above may be enough for all your searches, But I suspect you should allow for the required strings to be followed by punctuation or be at the end of the line, things which are hard to do with a simple LC wildcard search, at least in a single filter. The final tweak to account for a case insensitive search adds a flag at the front the of the regex (and I agree is rather arcane). If you want arcane, there is a possibly better way to do the regex search for either the whole word “you" or the whole word “u”. You can use the code “\b” to indicate a word boundary instead of a character, that is white space, punctuation or line start or end. filter tList with regex “.*with\b(you|u)\b.*” As usual with a complex language there are alternative ways of accomplishing the same thing. Hmm, if to be truthful, my previous regex doesn’t do precisely the same thing as looking for word boundaries (hyphens, numbers, hard spaces…human language is so complicated). I opine that regular expressions and sql are the two most useful technologies to add to the LC developer’s toolbox. After some basic user interface design principles course. Beyond those lie the web languages html, css, javascript (shudder). And then LCB, something I have yet to tackle. BTW, apologies for the “numeric” when I meant “alphabetic” in the previous email. It seems I cannot write an email these days without at leat one mistke. Neville > On 1 Nov 2023, at 7:54 pm, David V Glasgow wrote: > > This is the thing about regex, amazing,powerful, impressive, but scary as > hell. > > I will play with this a little, though… so thanks for your time when you > should have been doing something else. I appreciate it. > > Best Wishes, > > David Glasgow > Consultant Forensic & Clinical Psychologist > Carlton Glasgow Partnership > Director, Child & Family Training, York > Honorary Professor (SOCAMRU), Nottingham Trent University > > LinkedIn Profile > >> On 31 Oct 2023, at 8:59 pm, Neville Smythe via use-livecode >> mailto:use-livecode@lists.runrev.com>> wrote: >> >> Forgot any number of other chars after the non-numeric character >> >> Filter tList with regex "(?i).*with (you|u)([^a-zA-Z].*|$)” >> >> Now I’ve really got to go … hope I’ve got it all right this time! >> >> Neville Smythe ___ 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
Re: Filter with wildcards
This is the thing about regex, amazing,powerful, impressive, but scary as hell. I will play with this a little, though… so thanks for your time when you should have been doing something else. I appreciate it. Best Wishes, David Glasgow Consultant Forensic & Clinical Psychologist Carlton Glasgow Partnership Director, Child & Family Training, York Honorary Professor (SOCAMRU), Nottingham Trent University LinkedIn Profile > On 31 Oct 2023, at 8:59 pm, Neville Smythe via use-livecode > wrote: > > Forgot any number of other chars after the non-numeric character > > Filter tList with regex "(?i).*with (you|u)([^a-zA-Z].*|$)” > > Now I’ve really got to go … hope I’ve got it all right this time! > > Neville Smythe > > > > > ___ > 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
Re: Filter with wildcards
Thanks all for the suggestions, folks. I expected someone to mention regex (shudder). I have many searches in a loop and most are simple strings, so excepting regex filters would be a bit of a pain (unless of course I could specify regex but this would not choke if the search was simple string containing no regular expressions) Because I am lazy, and a simple soul, I will probably just split the task into two filter commands - which will deliver exactly what I want at only a minimal time and thought overhead. Cheers David G > On 30 Oct 2023, at 7:29 pm, Mark Waddingham via use-livecode > wrote: > > The filter command has had a ‘with[out] regex’ form for a long time - so I’d > use a regex instead :) > > (I’m pretty sure [ ] is a set of characters to match, rather than a list of > sub strings, in wildcard expressions) > > Warmest Regards, > > Mark. > > Sent from my iPhone > >> On 30 Oct 2023, at 17:19, David Glasgow via use-livecode >> wrote: >> >> Hi folks, >> >> I am doing the above and struggling with an oddity that I can’t find >> guidance on on Livecode or wider wildcard stuff >> >> A simple example is I am searching text messages for 'with you' or 'with u’ >> >> so I use the wildcard form >> >> *with [you,u]* >> >> That finds all examples of both just fine. However, it also finds ‘with >> unlimited cheese’ and 'with us’, ‘with yours’ etc. so I want a space after >> both u >> >> When I put two spaces inside the square brackets after each string, the >> search still works but spaces seem to be ignored (so still finds the above >> resamples I don’t want). >> >> If I put a single space after the brackets the first bracketed string is >> ignored and the filter only finds “with u “ >> >> Hope someone can help me stop pulling my baffled face >> >> Cheers >> >> David Glasgow >> >> >> ___ >> 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 ___ 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
Re: Filter with wildcards
Forgot any number of other chars after the non-numeric character Filter tList with regex "(?i).*with (you|u)([^a-zA-Z].*|$)” Now I’ve really got to go … hope I’ve got it all right this time! Neville Smythe ___ 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
Re: Filter with wildcards
Filter tList with regex "(?i).*with (you|u)( .*|\.|$)" I did forget something … wth you might be folllowed by a comma or colon or something so the last brackets should search for either any non alphabetic character or the end of line, so think (going from memory here) Filter tList with regex "(?i).*with (you|u)([^a-zA-Z]|$)” Neville Smythe ___ 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
Re: Filter with wildcards
Reglar expressions is definitely the way to go So you want to catch any number of characters .* Followed by the string “with “ .*with Followed by either “you” or “u” .*with (you|u) Followed by a space and then any umber of characters, giving .*with (you|u) .* Except you might want to look for lines ending in with you, or a period .*with (you|u)( .*|\.|$) And what about “With You”. Since regex is case sensitive by default (?i).*with (you|u)( .*|\.|$) Filter tList with regex "(?i).*with (you|u)( .*|\.|$)" Writing this in a rush so I hope I haven’t got that wrong Neville Smythe ___ 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
Re: Filter with wildcards
The filter command has had a ‘with[out] regex’ form for a long time - so I’d use a regex instead :) (I’m pretty sure [ ] is a set of characters to match, rather than a list of sub strings, in wildcard expressions) Warmest Regards, Mark. Sent from my iPhone > On 30 Oct 2023, at 17:19, David Glasgow via use-livecode > wrote: > > Hi folks, > > I am doing the above and struggling with an oddity that I can’t find guidance > on on Livecode or wider wildcard stuff > > A simple example is I am searching text messages for 'with you' or 'with u’ > > so I use the wildcard form > > *with [you,u]* > > That finds all examples of both just fine. However, it also finds ‘with > unlimited cheese’ and 'with us’, ‘with yours’ etc. so I want a space after > both u > > When I put two spaces inside the square brackets after each string, the > search still works but spaces seem to be ignored (so still finds the above > resamples I don’t want). > > If I put a single space after the brackets the first bracketed string is > ignored and the filter only finds “with u “ > > Hope someone can help me stop pulling my baffled face > > Cheers > > David Glasgow > > > ___ > 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
Re: Filter with wildcards
I think that matchText is what you are looking for. I have a proof stack which I shall upload to the forums, as obviously this is not possible here: https://forums.livecode.com/viewtopic.php?f=7=38698 Best, Richmond Mathewson. On 30.10.23 19:17, David Glasgow via use-livecode wrote: Hi folks, I am doing the above and struggling with an oddity that I can’t find guidance on on Livecode or wider wildcard stuff A simple example is I am searching text messages for 'with you' or 'with u’ so I use the wildcard form *with [you,u]* That finds all examples of both just fine. However, it also finds ‘with unlimited cheese’ and 'with us’, ‘with yours’ etc. so I want a space after both u When I put two spaces inside the square brackets after each string, the search still works but spaces seem to be ignored (so still finds the above resamples I don’t want). If I put a single space after the brackets the first bracketed string is ignored and the filter only finds “with u “ Hope someone can help me stop pulling my baffled face Cheers David Glasgow ___ 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
Re: Filter with wildcards
Oddly enough a matchChunk expression with "with you$" pulls out all the 'with you' stuff and excludes this sort of thing: 'with youthful naivety' . . . which is marvellous But a matchChunk expression with "with u$" catches nothing! On 30.10.23 20:11, Craig Newman via use-livecode wrote: Have not played with a method of keeping it all in one line. But can you filter twice, storing the first result and then running it again? Craig On Oct 30, 2023, at 1:17 PM, David Glasgow via use-livecode wrote: Hi folks, I am doing the above and struggling with an oddity that I can’t find guidance on on Livecode or wider wildcard stuff A simple example is I am searching text messages for 'with you' or 'with u’ so I use the wildcard form *with [you,u]* That finds all examples of both just fine. However, it also finds ‘with unlimited cheese’ and 'with us’, ‘with yours’ etc. so I want a space after both u When I put two spaces inside the square brackets after each string, the search still works but spaces seem to be ignored (so still finds the above resamples I don’t want). If I put a single space after the brackets the first bracketed string is ignored and the filter only finds “with u “ Hope someone can help me stop pulling my baffled face Cheers David Glasgow ___ 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 ___ 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
Re: Filter with wildcards
OK: well I had a bash with a set like this: with unlimited cheese with you with u with udders clagged with glaur with youthful naivety and your filter grabbed all of them. :( I tried this: with"with [you, u,]*" and got the same. On reading in the dictionary I found this: filtertVar with"[az]*"-- tVar contains all property names beginning with a or z and the problematic phrase is 'beginning with'. On 30.10.23 19:17, David Glasgow via use-livecode wrote: Hi folks, I am doing the above and struggling with an oddity that I can’t find guidance on on Livecode or wider wildcard stuff A simple example is I am searching text messages for 'with you' or 'with u’ so I use the wildcard form *with [you,u]* That finds all examples of both just fine. However, it also finds ‘with unlimited cheese’ and 'with us’, ‘with yours’ etc. so I want a space after both u When I put two spaces inside the square brackets after each string, the search still works but spaces seem to be ignored (so still finds the above resamples I don’t want). If I put a single space after the brackets the first bracketed string is ignored and the filter only finds “with u “ Hope someone can help me stop pulling my baffled face Cheers David Glasgow ___ 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
Re: Filter with wildcards
Have not played with a method of keeping it all in one line. But can you filter twice, storing the first result and then running it again? Craig > On Oct 30, 2023, at 1:17 PM, David Glasgow via use-livecode > wrote: > > Hi folks, > > I am doing the above and struggling with an oddity that I can’t find guidance > on on Livecode or wider wildcard stuff > > A simple example is I am searching text messages for 'with you' or 'with u’ > > so I use the wildcard form > > *with [you,u]* > > That finds all examples of both just fine. However, it also finds ‘with > unlimited cheese’ and 'with us’, ‘with yours’ etc. so I want a space after > both u > > When I put two spaces inside the square brackets after each string, the > search still works but spaces seem to be ignored (so still finds the above > resamples I don’t want). > > If I put a single space after the brackets the first bracketed string is > ignored and the filter only finds “with u “ > > Hope someone can help me stop pulling my baffled face > > Cheers > > David Glasgow > > > ___ > 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
Filter with wildcards
Hi folks, I am doing the above and struggling with an oddity that I can’t find guidance on on Livecode or wider wildcard stuff A simple example is I am searching text messages for 'with you' or 'with u’ so I use the wildcard form *with [you,u]* That finds all examples of both just fine. However, it also finds ‘with unlimited cheese’ and 'with us’, ‘with yours’ etc. so I want a space after both u When I put two spaces inside the square brackets after each string, the search still works but spaces seem to be ignored (so still finds the above resamples I don’t want). If I put a single space after the brackets the first bracketed string is ignored and the filter only finds “with u “ Hope someone can help me stop pulling my baffled face Cheers David Glasgow ___ 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
Re: Escaping the Filter command's wildcards
At 6:30 PM -0700 5/22/2013, Peter Haworth wrote: I do find it strange that filter doesn't support full regexp syntax, seems like RunRev would have had to write special code instead of using standard regexp libraries which they use in other commands It was never supposed to be a regex command at all. The wildcard syntax is different (it's what's used in Unix shells - that's where it came from). -- jeanne a. e. devoto livec...@jaedworks.com ___ 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
Re: Escaping the Filter command's wildcards
Well it sounds like it will support full rgexp in the near future courtesy of Jan Schenkel and OSS. Pete lcSQL Software http://www.lcsql.com On Sat, May 25, 2013 at 4:46 PM, Jeanne A. E. DeVoto revolut...@jaedworks.com wrote: At 6:30 PM -0700 5/22/2013, Peter Haworth wrote: I do find it strange that filter doesn't support full regexp syntax, seems like RunRev would have had to write special code instead of using standard regexp libraries which they use in other commands It was never supposed to be a regex command at all. The wildcard syntax is different (it's what's used in Unix shells - that's where it came from). -- jeanne a. e. devoto livec...@jaedworks.com __**_ 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-livecodehttp://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
Re: Escaping the Filter command's wildcards
There has been an enhancement request in the quality center for a few years now. http://quality.runrev.com/show_bug.cgi?id=2805 But now that it's all open source, we can do these changes ourselves. It looks like it can be accomplished by modifying just a single file: cmdsf.cpp https://github.com/runrev/livecode/blob/master/engine/src/cmdsf.cpp Maybe we should have a discussion on the engine forum to see who wants to take this on. To prevent breaking existing scripts, I'd suggest as syntax: filter container matching regex (which means we'd have to add a keyword 'matching' to the language but that shouldn't be too hard either) Anyway, open up the discussion on the engine forum :-) http://forums.runrev.com/viewforum.php?f=66 Cheers, Jan Schenkel. = Quartam Reports PDF Library for LiveCode www.quartam.com = As we grow older, we grow both wiser and more foolish at the same time. (La Rochefoucauld) - Original Message - From: Peter Haworth p...@lcsql.com To: How to use LiveCode use-livecode@lists.runrev.com Cc: Sent: Thursday, May 23, 2013 3:30 AM Subject: Re: Escaping the Filter command's wildcards I do find it strange that filter doesn't support full regexp syntax, seems like RunRev would have had to write special code instead of using standard regexp libraries which they use in other commands Shouldn't be too difficult to write a myFilter function that supports full regexp syntax using a repeat loop and matchText but we shouldn't really have to take the time to do that. Pete lcSQL Software http://www.lcsql.com On Wed, May 22, 2013 at 6:07 PM, Paul Dupuis p...@researchware.com wrote: On 5/22/2013 8:32 PM, Mark Schonewille wrote: Hi Paul, I see what you mean. You weren't looking for a solution, just for more trouble :-) I tried several special characters and they can all be used to filter lines with the same workaround. Unfortunately, many of those special characters have no effect, because regex isn't fully supported by the filter command, as Pete mentioned already. Therefore I wonder why we need to escape the question mark. That seems inconsistent to me. Since ?, *, [, and ] are used as special characters, it is possible, thought unlikely, to need to escape any or all of them in the pattern to actually filter on those characters. It turns out you can escape ? and * by using [?] or [*] which treats the character in the bracket as a character to me matched rather than a wildcard. I have not explored how it may be possible to escape the brackets Of course, you could do some pre-processing of the source data to replace those characters with some token that is guaranteed not to be in the source text, then apply the filter and then replace the token(s) with the original characters, so there are always a work-around in code. I was mostly wondering if there was an 'undocumented' escape character others on the list had found but no one bothered to add a not to the dictionary for. However, I guess that is not the case. ___ 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 ___ 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
Re: Escaping the Filter command's wildcards
For those interested, I started the discussion on the engine contributors forum: http://forums.runrev.com/viewtopic.php?f=66t=15250 Cheers, Jan Schenkel. = Quartam Reports PDF Library for LiveCode www.quartam.com = As we grow older, we grow both wiser and more foolish at the same time. (La Rochefoucauld) ___ 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
Re: Escaping the Filter command's wildcards
Thanks Jan. Pete lcSQL Software http://www.lcsql.com On Thu, May 23, 2013 at 10:10 AM, Jan Schenkel janschen...@yahoo.comwrote: For those interested, I started the discussion on the engine contributors forum: http://forums.runrev.com/viewtopic.php?f=66t=15250 Cheers, Jan Schenkel. = Quartam Reports PDF Library for LiveCode www.quartam.com = As we grow older, we grow both wiser and more foolish at the same time. (La Rochefoucauld) ___ 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
Escaping the Filter command's wildcards
The filter command in LiveCode appears to accept a regular expression (using ? for a single character match, * for multiple character match, [chars] and [char-char]). However, if you want to filter a container to a string where you pattern contains a question mark, it does not appear that you can escape the ? with \? in the pattern to have it treated as a real question mark instead of a wild card. While \? does not cause ? to be treated as a question mark instead of a wild card, using [?] does appear to treat it as a real character and not as a wild card. Does any one have any knowledge of escaping the special characters listed in the Dictionary? Or whether other regex special characters can be used beyond those listed? ___ 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
Re: Escaping the Filter command's wildcards
Hi Paul, This works fine for me: put replacetext(xxx?!xxx,[\?!],) -- xx What exactly is the problem you're having? Could you post some of the code that doesn't work for you? -- Best regards, Mark Schonewille Economy-x-Talk Consulting and Software Engineering Homepage: http://economy-x-talk.com Twitter: http://twitter.com/xtalkprogrammer KvK: 50277553 Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other colour spaces. http://www.color-converter.com Buy my new book Programming LiveCode for the Real Beginner http://qery.us/3fi On 5/22/2013 23:16, Paul Dupuis wrote: The filter command in LiveCode appears to accept a regular expression (using ? for a single character match, * for multiple character match, [chars] and [char-char]). However, if you want to filter a container to a string where you pattern contains a question mark, it does not appear that you can escape the ? with \? in the pattern to have it treated as a real question mark instead of a wild card. While \? does not cause ? to be treated as a question mark instead of a wild card, using [?] does appear to treat it as a real character and not as a wild card. Does any one have any knowledge of escaping the special characters listed in the Dictionary? Or whether other regex special characters can be used beyond those listed? ___ 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
Re: Escaping the Filter command's wildcards
Paul, I read your message three more times, and I think I should note that put replacetext(xxx?!xxx,\?,) works too: -- xxx!xxx in addition to put replacetext(xxx?!xxx,[\?!],) -- xx -- Best regards, Mark Schonewille Economy-x-Talk Consulting and Software Engineering Homepage: http://economy-x-talk.com Twitter: http://twitter.com/xtalkprogrammer KvK: 50277553 Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other colour spaces. http://www.color-converter.com Buy my new book Programming LiveCode for the Real Beginner http://qery.us/3fi On 5/22/2013 23:16, Paul Dupuis wrote: The filter command in LiveCode appears to accept a regular expression (using ? for a single character match, * for multiple character match, [chars] and [char-char]). However, if you want to filter a container to a string where you pattern contains a question mark, it does not appear that you can escape the ? with \? in the pattern to have it treated as a real question mark instead of a wild card. While \? does not cause ? to be treated as a question mark instead of a wild card, using [?] does appear to treat it as a real character and not as a wild card. Does any one have any knowledge of escaping the special characters listed in the Dictionary? Or whether other regex special characters can be used beyond those listed? ___ 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
Re: Escaping the Filter command's wildcards
I think there's been discussions on the list before about the filter command and the fact that it doesn't seem to support the full regexp syntax, only the specific functionality described in the dictionary Pete lcSQL Software http://www.lcsql.com On Wed, May 22, 2013 at 2:16 PM, Paul Dupuis p...@researchware.com wrote: The filter command in LiveCode appears to accept a regular expression (using ? for a single character match, * for multiple character match, [chars] and [char-char]). However, if you want to filter a container to a string where you pattern contains a question mark, it does not appear that you can escape the ? with \? in the pattern to have it treated as a real question mark instead of a wild card. While \? does not cause ? to be treated as a question mark instead of a wild card, using [?] does appear to treat it as a real character and not as a wild card. Does any one have any knowledge of escaping the special characters listed in the Dictionary? Or whether other regex special characters can be used beyond those listed? ___ 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
Re: Escaping the Filter command's wildcards
On 5/22/2013 5:37 PM, Mark Schonewille wrote: Hi Paul, This works fine for me: put replacetext(xxx?!xxx,[\?!],) -- xx What exactly is the problem you're having? Could you post some of the code that doesn't work for you? it is with the filter command not the replaceText function I ran into a problem: If you have a variable tSource with following 3 lines: sometext? sometext! sometext. and filter tSource with sometext? you get all 3 lines instead of just the one with the ? at the end. filter tSource with sometext[?] filters to just the expected line, so that is a work-around to solve what I needed to do. I was surprised that filter tSource with sometext\? did NOT work (since that would have been a valid regex pattern to filter to just the line with the ?). However the experience made me curious as to what other inconsistencies with the filter command folks may have uncovered. ___ 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
Re: Escaping the Filter command's wildcards
Hi Paul, I see what you mean. You weren't looking for a solution, just for more trouble :-) I tried several special characters and they can all be used to filter lines with the same workaround. Unfortunately, many of those special characters have no effect, because regex isn't fully supported by the filter command, as Pete mentioned already. Therefore I wonder why we need to escape the question mark. That seems inconsistent to me. -- Best regards, Mark Schonewille Economy-x-Talk Consulting and Software Engineering Homepage: http://economy-x-talk.com Twitter: http://twitter.com/xtalkprogrammer KvK: 50277553 Use Color Converter to convert CMYK, RGB, RAL, XYZ, H.Lab and other colour spaces. http://www.color-converter.com Buy my new book Programming LiveCode for the Real Beginner http://qery.us/3fi On 5/23/2013 01:26, Paul Dupuis wrote: On 5/22/2013 5:37 PM, Mark Schonewille wrote: Hi Paul, This works fine for me: put replacetext(xxx?!xxx,[\?!],) -- xx What exactly is the problem you're having? Could you post some of the code that doesn't work for you? it is with the filter command not the replaceText function I ran into a problem: If you have a variable tSource with following 3 lines: sometext? sometext! sometext. and filter tSource with sometext? you get all 3 lines instead of just the one with the ? at the end. filter tSource with sometext[?] filters to just the expected line, so that is a work-around to solve what I needed to do. I was surprised that filter tSource with sometext\? did NOT work (since that would have been a valid regex pattern to filter to just the line with the ?). However the experience made me curious as to what other inconsistencies with the filter command folks may have uncovered. ___ 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
Re: Escaping the Filter command's wildcards
On 5/22/2013 8:32 PM, Mark Schonewille wrote: Hi Paul, I see what you mean. You weren't looking for a solution, just for more trouble :-) I tried several special characters and they can all be used to filter lines with the same workaround. Unfortunately, many of those special characters have no effect, because regex isn't fully supported by the filter command, as Pete mentioned already. Therefore I wonder why we need to escape the question mark. That seems inconsistent to me. Since ?, *, [, and ] are used as special characters, it is possible, thought unlikely, to need to escape any or all of them in the pattern to actually filter on those characters. It turns out you can escape ? and * by using [?] or [*] which treats the character in the bracket as a character to me matched rather than a wildcard. I have not explored how it may be possible to escape the brackets Of course, you could do some pre-processing of the source data to replace those characters with some token that is guaranteed not to be in the source text, then apply the filter and then replace the token(s) with the original characters, so there are always a work-around in code. I was mostly wondering if there was an 'undocumented' escape character others on the list had found but no one bothered to add a not to the dictionary for. However, I guess that is not the case. ___ 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
Re: Escaping the Filter command's wildcards
I do find it strange that filter doesn't support full regexp syntax, seems like RunRev would have had to write special code instead of using standard regexp libraries which they use in other commands Shouldn't be too difficult to write a myFilter function that supports full regexp syntax using a repeat loop and matchText but we shouldn't really have to take the time to do that. Pete lcSQL Software http://www.lcsql.com On Wed, May 22, 2013 at 6:07 PM, Paul Dupuis p...@researchware.com wrote: On 5/22/2013 8:32 PM, Mark Schonewille wrote: Hi Paul, I see what you mean. You weren't looking for a solution, just for more trouble :-) I tried several special characters and they can all be used to filter lines with the same workaround. Unfortunately, many of those special characters have no effect, because regex isn't fully supported by the filter command, as Pete mentioned already. Therefore I wonder why we need to escape the question mark. That seems inconsistent to me. Since ?, *, [, and ] are used as special characters, it is possible, thought unlikely, to need to escape any or all of them in the pattern to actually filter on those characters. It turns out you can escape ? and * by using [?] or [*] which treats the character in the bracket as a character to me matched rather than a wildcard. I have not explored how it may be possible to escape the brackets Of course, you could do some pre-processing of the source data to replace those characters with some token that is guaranteed not to be in the source text, then apply the filter and then replace the token(s) with the original characters, so there are always a work-around in code. I was mostly wondering if there was an 'undocumented' escape character others on the list had found but no one bothered to add a not to the dictionary for. However, I guess that is not the case. ___ 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