C:\>perl -MYAPE::Regex::Explain -e "print YAPE::Regex::Explain->new(qr|^.+')'[\s\t]+(\ w+),[\s\t]+(\w)$|)->explain" Unmatched ) before HERE mark in regex m/^.+') << HERE '[\s\t]+(\w+),[\s\t]+(\w)$ / at -e line 1. C:\>perl -MYAPE::Regex::Explain -e "print YAPE::Regex::Explain->new(qr|^.+'\) s\t]+(\w+),[\s\t]+(\w)$|)->explain" The regular expression: (?-imsx:^.+'\)'[\s\t]+(\w+),[\s\t]+(\w)$) 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 ---------------------------------------------------------------------- .+ any character except \n (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ' '\'' ---------------------------------------------------------------------- \) ')' ---------------------------------------------------------------------- ' '\'' ---------------------------------------------------------------------- [\s\t]+ any character of: whitespace (\n, \r, \t, \f, and " "), '\t' (tab) (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ( group and capture to \1: ---------------------------------------------------------------------- \w+ word characters (a-z, A-Z, 0-9, _) (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- , ',' ---------------------------------------------------------------------- [\s\t]+ any character of: whitespace (\n, \r, \t, \f, and " "), '\t' (tab) (1 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ( group and capture to \2: ---------------------------------------------------------------------- \w word characters (a-z, A-Z, 0-9, _) ---------------------------------------------------------------------- ) end of \2 ---------------------------------------------------------------------- $ before an optional \n, and the end of the string ---------------------------------------------------------------------- ) end of grouping ---------------------------------------------------------------------- C:\>perl -v This is perl, v5.6.1 built for MSWin32-x86-multi-thread (with 1 registered patch, see perl -V for more detail) Copyright 1987-2001, Larry Wall Binary build 635 provided by ActiveState Corp. http://www.ActiveState.com Built 15:34:21 Feb 4 2003 Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using `man perl' or `perldoc perl'. If you have access to the Internet, point your browser at http://www.perl.com/, the Perl Home Page. C:\>