As a general thing any .[*+] match is suspect. An often useful trick is to use a negative lookahead match to nibble one character at a time:
my $str = "Send it to bob.sled\@gmail.com. Don't send it to ski.guy\@y +ahoo.com."; print "$1\n" if $str =~ /(( (?!\.\s). )+ \.\s)/x;
Prints:
Send it to bob.sled@gmail.com.
In reply to Re: problem with optional capture group
by GrandFather
in thread problem with optional capture group
by Special_K
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |