m/(^[a-z0-9]{4})$/ #### #!/usr/bin/perl use warnings; use strict; use YAPE::Regex::Explain; my $re = qq[m!(^[a-z0-9]{4})$!]; my $yape = YAPE::Regex::Explain->new($re); print $yape->explain; __END__ The regular expression: (?-imsx:m!(^[a-z0-9]{4})) 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): ---------------------------------------------------------------------- m! 'm!' ---------------------------------------------------------------------- ( group and capture to \1: ---------------------------------------------------------------------- ^ the beginning of the string ---------------------------------------------------------------------- [a-z0-9]{4} any character of: 'a' to 'z', '0' to '9' (4 times) ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------