in reply to Re: Promiscuously match what might be prices
in thread Promiscuously match what might be prices

Thanks diotalevi. I think your suggestion will be fine. I just didn't read the manual carefully enough.

I wound up with

my $promiscuous_price = qr/ (?: $RE{num}{real} #matches 123456.78 | $RE{num}{real}{-radix => qr/[.]/}{-sep => qr/[,]/} #matches 123, +456.78 | $RE{num}{real}{-radix => qr/[,]/}{-sep => qr/[.]/} #matches 123. +456,78 ) /x;

Replies are listed 'Best First'.
Re^3: Promiscuously match what might be prices
by diotalevi (Canon) on Apr 10, 2006 at 18:45 UTC

    Unless you really need it, you should prefer saying \, and \. to [.] and [,]. You're disabling some important optimizations when you move literal text into a character class. Perl doesn't recognize that a single character class is equivalent to a literal character and this prevents its Boyer-Moore string matching from working effectively. That's one of the things that helps to make perl's regex so legendarilly fast.

    ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊