Re: Escaping the Filter command's wildcards

2013-05-25 Thread Jeanne A. E. DeVoto

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

2013-05-25 Thread Peter Haworth
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

2013-05-23 Thread Jan Schenkel
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

2013-05-23 Thread Jan Schenkel
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

2013-05-23 Thread Peter Haworth
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


Re: Escaping the Filter command's wildcards

2013-05-22 Thread Mark Schonewille

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

2013-05-22 Thread Mark Schonewille

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

2013-05-22 Thread Peter Haworth
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

2013-05-22 Thread Paul Dupuis
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

2013-05-22 Thread Mark Schonewille

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

2013-05-22 Thread Paul Dupuis
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

2013-05-22 Thread Peter Haworth
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