$text = 'firstname.lastname@example.org type add (#090930-230011-907000 ur22122021
$text =~ s/.*\s(\w+)@(\w+)\.com .*/$1@$2\.(\w+)/;
Say, for instance, this were to happen (a variable has a weird-ass value, and you try to parse an email address out of it). Why isn't the regex extracting the email address from this string? I can't find it out.
EDIT: By the by, this code fragment is not what is used. The regex is used, but the variable is initialized through a large process in my code that I can't really release on here.
EDIT 2: Thanks to some of the help on this thread, I was able to get the proper regex, $text =~ /(\w+)@(\w+)\.com/;. Thanks to everyone for trying to help :)