From: Brian Deacon <[EMAIL PROTECTED]>

^((crazy)( )*[;\,]( )*)*(crazy)( )*[;\,]?$

Gack... even that version looks gnarly...

Anywho... the idea is to verify that the input is a string of either
comma or semi-colon delimited instances of "crazy".  Any amount of
spaces surrounding the delimiters.  The catch is that I don't want to
require that the input end in a delimiter, so that any of these would
be valid:
crazy
crazy, crazy
crazy,crazy,crazy
crazy,crazy;crazy;

Wouldn't

(\w*crazy\w*)([\,;](\w*crazy\w*))*

do this? (\w*crazy\w*) should be crazy followed by any amount of white space. [\,;]\w*crazy\w* should be crazy preceeded by a , or ; with any amount of whitespace. By *ibng that part, you can have any number of additional crazies. Actually on relook, I think I got almost the same thing except I used \w for whitespace, which seems like a better choice than ( ) and I put the optional crazies on the end, not the begining.

And the above works fine for that.  The problem is that I'm not actually
looking for the word "crazy", I'm looking for valid smtp email
addresses.  I stole a >500 character long regex from regexlib.com
Umm... this one:
http://www.regexlib.com/REDetails.aspx?regexp_id=328

Thats because SMTP is absolutely insane in the number of legal options for an email address (an IP is a legal address for some reason). If you need to work with anything, you need something complex.

Gabe


-- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to