use YAPE::Regex::Explain; $REx = 'm/\.swf(?:\?.*)?$/oi'; my $exp = YAPE::Regex::Explain->new($REx)->explain; print $exp; output: ------- The regular expression: (?-imsx:m/\.swf(?:\?.*)?$/oi) 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/' ---------------------------------------------------------------------- \. '.' ---------------------------------------------------------------------- swf 'swf' ---------------------------------------------------------------------- (?: group, but do not capture (optional (matching the most amount possible)): ---------------------------------------------------------------------- \? '?' ---------------------------------------------------------------------- .* any character except \n (0 or more times (matching the most amount possible)) ---------------------------------------------------------------------- )? end of grouping ---------------------------------------------------------------------- $ before an optional \n, and the end of the string ---------------------------------------------------------------------- /oi '/oi' ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------