in reply to 5.6.0 change on 5.8.0 - ahhh!

As a side note I don't see how that regex could EVER have worked on any perl ever.

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 ki +t. 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 Pa +ge. C:\>

Not only does it not compile under 5.6.1 but if you add the required escape on the ) ie \) you can see that it is looking for literally ')' ie single quote RT bracket single quote (does not exist) and at the end of the string it is only matching \w+ which are the chars A-Za-z0-9_ inclusive which will NEVER match 8:42:33.91 due to the fact that there are colons and . chars there too......

Note that \s matches ' ' \t \r \n so \s\t is unnecessary just \s is all that is required.

cheers

tachyon

Replies are listed 'Best First'.
Re: Re: 5.6.0 change on 5.8.0 - ahhh!
by Anonymous Monk on Dec 24, 2003 at 04:48 UTC
    I swear to you it works on my netbsd box running perl 5.6.0 but your way is better, thanks a lot. and the quick reply too.