I have a regex expression in Perl that I've been trying to figure out for a while, but still have trouble understanding what it does. The regex is the following:
($last,$first,$middle) = $name =~ /^(.*)_([A-Z][^A-Z]*)([A-Z][a-z]*)?/;
The
means any sequence of characters, (.*)
followed by underscore, not sure what _
and ([A-Z][^A-Z]*)
do. ([A-Z][a-z]*)?
And also how is expression executed? Is this same as below:
$name =~ /^(.*)_([A-Z][^A-Z]*)([A-Z][a-z]*)?/;
($last,$first,$middle) = $name
Thanks for any help!