use Regexp::English; print Regexp::English ->new ->beginning_of_string ->literal('SR') ->digit ->digit ->digit ->digit ->digit ->digit ->digit ->end_of_string, "\n"; __END__ (?^:\ASR\d\d\d\d\d\d\d\Z) #### use YAPE::Regex::Explain; print YAPE::Regex::Explain->new( qr{(?:\ASR\d\d\d\d\d\d\d\Z)} )->explain; __END__ The regular expression: (?-imsx:(?:\ASR\d\d\d\d\d\d\d\Z)) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?-imsx: group, but do not capture (case-sensitive) (with ^ and $ matching normally) (with . not matching \n) (matching whitespace and # normally): ---------------------------------------------------------------------- (?: group, but do not capture: ---------------------------------------------------------------------- \A the beginning of the string ---------------------------------------------------------------------- SR 'SR' ---------------------------------------------------------------------- \d digits (0-9) ---------------------------------------------------------------------- \d digits (0-9) ---------------------------------------------------------------------- \d digits (0-9) ---------------------------------------------------------------------- \d digits (0-9) ---------------------------------------------------------------------- \d digits (0-9) ---------------------------------------------------------------------- \d digits (0-9) ---------------------------------------------------------------------- \d digits (0-9) ---------------------------------------------------------------------- \Z before an optional \n, and the end of the string ---------------------------------------------------------------------- ) end of grouping ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------