original pseudo-regex: test_%a%b modified regex: test_(\d{2})(?{ $mv{a} = $^N })(\d{4})(?{ $mv{b} = $^N }) Matching on test_001022 Result: a => 00 b => 1022 Matching on test_585381 No keys in hash. No match. Matching on test_389742 No keys in hash. No match. Matching on test_330104 No keys in hash. No match.