in reply to Newbie reg.exp question!
See man perlretut and man perlre for more info.my $string = "PM123456789some more text"; my($chars, $nums, $rest) = $string =~ m{ ^ # start of the string ( [a-z]{2} ) # capture 2 chars ( \d{9} ) # capture 9 digits ( .* ) # capture the rest \z # end of the string }ix; print "chars: $chars", $/, "nums: $nums", $/, "rest: $rest", $/; __output__ chars: PM nums: 123456789 rest: some more text
_________
broquaint
|
|---|