rpike has asked for the
wisdom of the Perl Monks concerning the following question:
I have a regular expression in place that does a check on a string coming in from a form. The regular expression is as such :
$string =~ m/^(frm)(\w+)(txt)?$/;
What I was hoping to accomplish was to have $1, $2, and $3 populated with the values in the brackets. When I run this and the string is something like frmNametxt the $1 gets set to frm, $2 gets set to Nametxt and $3 to nothing. What (if anything) can I do to force the code to evaluate and store txt into $3? If txt is there I want it put into $3. Any help would be most appreciated. Thanks.