BTW, I was scratching my head about this, and had to hit the books.

There is special handling for '-' inside [^...] expressions.  The '-' has to
be first or last.  Here's a test using Unix grep - which implements the same
POSIX REs as Witango:


[EMAIL PROTECTED]:~$ echo -e "ABCabc123\/:-.\nABCabc123\/:-. ?+=*"
ABCabc123\/:-.
ABCabc123\/:-. ?+=*
[EMAIL PROTECTED]:~$ echo -e "ABCabc123\/:-.\nABCabc123\/:-. ?+=*" | grep -E
"[^A-Za-z0-9\/:-.]"
ABCabc123\/:-.
ABCabc123\/:-. ?+=*
[EMAIL PROTECTED]:~$ echo -e "ABCabc123\/:-.\nABCabc123\/:-. ?+=*" | grep -E
"[^-A-Za-z0-9\/:.]"
ABCabc123\/:-. ?+=*
[EMAIL PROTECTED]:~$ echo -e "ABCabc123\/:-.\nABCabc123\/:-. ?+=*" | grep -E
"[^A-Za-z0-9\/:.-]"
ABCabc123\/:-. ?+=*
[EMAIL PROTECTED]:~$


Everything you ever wanted to know about POSIX REs (and more):

http://www.tin.org/bin/man.cgi?section=7&topic=regex



-----Original Message-----
From: Wayne Irvine [mailto:[EMAIL PROTECTED]
Sent: Monday, May 14, 2007 9:28 PM
To: [email protected]
Subject: Re: Witango-Talk: REGEX question


Jesse Parker at [EMAIL PROTECTED] wrote:

> I think <@KEEP> would be an easier way to do this.
>
> <@IFEQUAL @@local$string <@KEEP @@local$string
> "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789">>
>   No non-alphanumeric characters
> </@IF>

I'm currently using the above as it is not as simple as just allowing
alphanumerics. Some other characters are allowed and I won't be surprised if
more spring up in the future.

This way if & becomes acceptable I can just add it to the keep statement.

> EXPR="[^A-Za-z0-9\\/:\-\.]"

But I might also have a play around with this for the sake of learning.

Thanks guys,

Wayne Irvine

                  Byte Services Pty Ltd
               http://www.byteserve.com.au/
                  [EMAIL PROTECTED]
   Ph 02 9960 6099   Mob 0409 960 609   Fax 02 9960 6088

________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf

Reply via email to