in reply to Re: (nrd)Regex Help
in thread Parsing email addresses (was: Regex Help)

/\@(.+?)\s/;

That wouldn't match his example, "fake@email.com" due to the \s and the fact that his example has no whitespace. You also don't need to escape the @.

This:

/@(.*)/
would work.

Note that, without anchoring the end of it, you must .* rather than .*? because the latter can (and would) match nothing (i.e. an empty match) and end.

Of course, I agree that you shouldn't use a regex for this anyway so caveats, disclaimers, etc. :-)

-sauoq
"My two cents aren't worth a dime.";

Replies are listed 'Best First'.
Re: Re: Re: (nrd)Regex Help
by newrisedesigns (Curate) on Aug 29, 2002 at 12:30 UTC

    Very true.

    I assumed he'd be pulling the addresses out of a text file (or HTML) and now that I think about it, (") would be a better ending boundary for HTML.

    D'oh. You know what they say when you assume... : /

    John J Reiser
    newrisedesigns.com