On Tue, Jul 08, 2003 at 02:48:59PM -0400, Paul Kraus wrote: > Expression > /Sales - Freight - Leimkuehler\s+(\d+,?\d+\.?\d+)/ > > String > 410-02-00 Sales - Freight - Leimkuehler > 6.96 > > It does match if I remove everything after Leimkuehler. > This is how it reads to me > > 1 or more spaces > Open paren to save value to $1 > 1 or more digits > Maybe a comma but not necessary > 1 or more digits > Maybe a period but its not necessary. > 1 or more digits
Good analysis. > I am assuming my the problem is with ,? But I don't understand why. More likely, your problem is the fact that you have a \n before the 6.96. You can either put a literal \n in your pattern or add the 's' modifier on your regex (e.g. /foo/s) so that the '.' metacharacter can match \n as well as anything else. Rather than trying to parse the numbers yourself, you migth want to use Regexp::Common, available from CPAN. http://search.cpan.org/author/ABIGAIL/Regexp-Common-2.113/lib/Regexp/Common.pm Note that (as with any other precompiled rexex), the regexen supplied via this module may be compiled into other regexen like so (run the following to check): #!/usr/bin/perl my $a = qr/foo/; my $b = qr/bar/; $_ = "foobar"; print "Yes!" if /$a$b/; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]