http://www.perlmonks.org?node_id=94577

bobione has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, Kings of Regular Expression.
I have got an horrible RE problem (for me :)

I'd like to match a variable witch could be both value of $_ and return a value of the mail or an empty value.

$_ = '<A class=Member href="mailto:pluton_pluton@yahoo.fr">'; $_ = '<A class=Title>'; if (/^.*(?:mailto:)([^>]*)?"?>.*$/) {print "MATCH - ($1)";} else {print "DONT MATCH";}

This doesn't match "Mail-Less" case, and prefere keep the last double-quote (") because there's a (?).

I know it's a real small question, but that make me crazy !!
Thanks for your help.

BobiOne KenoBi ;)