#!/usr/bin/perl use YAPE::Regex::Explain; print YAPE::Regex::Explain->new(qr/^\(\d{3}\) \d{3}-\d{4}$/)->explain; __END__ The regular expression: (?-imsx:^\(\d{3}\) \d{3}-\d{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): ^ the beginning of the string \( '(' \d{3} digits (0-9) (3 times) \) ')' ' ' \d{3} digits (0-9) (3 times) - '-' \d{4} digits (0-9) (4 times) $ an optional \n followed by the end of the string )