in reply to slightly broken reg-ex

I agree with the recommendation for Email::Valid. The issue with your code seems straightforward: there's never any assignment to $1 or $2. Those should be "captured" by parenthesized groups in your regex. You may also want to trim or anchor the expression to ensure you're not clipping out an improper subset of the offered string.
if ($tainted =~ / ^ # don't start mid-string \s* # skip any leading space (\w{3}[\w.]*) # prefix to $1 \@ ([\w.]+) # hostname to $2 \s* # skip any trailing space $ /x) # don't end mid-string { $untainted = "$1\@$2"; }

--
[ e d @ h a l l e y . c c ]

Replies are listed 'Best First'.
Re: Re: slightly broken reg-ex
by jcpunk (Friar) on Jul 02, 2003 at 15:26 UTC
    thank you very much for the time you put into that
    jcpunk

    by the way thanks for all the help that was, is, and will be