This isn't even vaguely linux related... but regex seems to be such a fetish for linux folk. :)
Okee... so I've got this: ^((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; 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 So... /s/crazy/500characters And I've got a 1k regular expression. What I'd like is some way to accomplish the above without the 500 characters having to be repeated a second time. The only reason I needed to do it was that I can't require the string to end in a delimiter. It works the way it is... and I could just close the file and hope I never have to look at it again... but the urge to Not Suck makes me not want to leave that mess for somebody else to deal with months from now... and more importantly... I might be that somebody else. :) Especially since I predict a QA round will give rises to alternate interpretations of what "valid smtp address" means. The one I picked isn't fully RFC-compliant anyway... I know already that they won't want that. Wasn't until I dug up that regex and then looked at the RFC that I saw that "My Name"@domain.tld is a valid address. Anywho... any help with the above regex is GREATLY appreciated. And do feel free to stick with "crazy" or "foo" or what have you... B -- [email protected] http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list
