RE: testing on email characters

2001-06-14 Thread Jeff Yoak
At 02:17 PM 6/13/01 -0700, Peter Cornelius wrote: >I've never used Email::Valid but it may be a good way to solve the problem, >I'd be impressed if it actually catches all valid addresses (and very >happy). I've always just accepted that there would be some special cases >that wouldn't be caught

RE: testing on email characters

2001-06-13 Thread Peter Cornelius
> Subject: testing on email characters I just wanted to expand on Jeff Yoaks comment that the regexes discussed in this thread don't actually validate syntax on _all_ e-mail addresses. I think this is a common problem. I remember looking this up in 'Mastering Regular Expressio

Re: testing on email characters

2001-06-13 Thread Jeff Yoak
o point out here is that these expressions have nothing to do with "testing on email characters." They will pass things that aren't valid email addresses and they reject many things that are. The Internet is full of people doing things like this: if ($email =~ /[\w\.-]+\@[\w\.-

Re: testing on email characters

2001-06-13 Thread Chas Owens
/^[\w.-]+$/ and !/[^\w.-]/ have one major difference (and I am kicking myself for not seeing it until now). The former requires that at least one character must exist. !/[^\w.-]/ is equivalent to /[^[\w.-]*$/. However, this can be overcome by saying !(/^$/ or /[^\w.-]/) and it still has one ad

Re: testing on email characters

2001-06-12 Thread Michael Fowler
On Tue, Jun 12, 2001 at 02:19:23PM -0400, Chas Owens wrote: > /[\W.-]/ expands to /[[^a-zA-Z0-9_].-]/ Conceptually, yes, but the pattern /[[^a-zA-Z0-9_].-]/ isn't going to give you what you seem to expect if you were to actually try to use it. \w, \W, \d, \D, and friends are magic like that; the

Re: testing on email characters

2001-06-12 Thread Chas Owens
On 12 Jun 2001 18:45:23 +0200, Jos Boumans wrote: > Please, if you try and flame posts, get your facts straight. > > 1st: - is a range operator, and hence needs not be escaped when it's not > indicating a range, ie, at the beginning or end of a [] > so this regex is not 'wrong'. fee

Re: testing on email characters

2001-06-12 Thread Jos Boumans
Please, if you try and flame posts, get your facts straight. 1st: - is a range operator, and hence needs not be escaped when it's not indicating a range, ie, at the beginning or end of a [] so this regex is not 'wrong'. feel free to try it. 2nd:the regex is purposely written ver

Re: testing on email characters

2001-06-12 Thread Chas Owens
On 12 Jun 2001 17:45:16 +0200, Jos Boumans wrote: > try this: > > unless (/^[-\.\w]+$/) { print "you cheater!" } > > this will check if from beginning to end of $_ it contains - . (not even sure > you need to \ the . ) or any word character (a-z A-Z and _ ) > > the ^ says to start at the beginn

Re: testing on email characters

2001-06-12 Thread Jos Boumans
try this: unless (/^[-\.\w]+$/) { print "you cheater!" } this will check if from beginning to end of $_ it contains - . (not even sure you need to \ the . ) or any word character (a-z A-Z and _ ) the ^ says to start at the beginning of the string... the $ says to read till end of line... i'm o

testing on email characters

2001-06-12 Thread charles
if ( $add_alias =~ /\@/ ) { right now i am testing a variable to see if it contains an \@ character. i would prefer to test it to see if it has anything *other* than a-zA-Z0-9\.\-\_ can i do this with a regex like if ( $add_alias =~ /[^a-zA-Z0-9\.\-\_]/ ) { i am not certain if my sear