[Moved over from p6i, to more appropriate p6l] On Sat, 2002-09-07 at 12:03, Mr. Nobody wrote: > While Apocolypse 5 raises some good points about problems with the old regex > syntax, its new syntax is actually worse than in perl 5. Most regexes, such > as this one to match a C float > > /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/ > > would actually become longer: > > /^(<[+-]>?)<before \d|\.\d>\d*(\.\d*)?(<[Ee]>(<[+-]>?\d+))?$/
Longer != worse. Your example is not the norm, but the exception (lookahead assertions are certainly not in most Perl 5 regular expressions). A5 tried to stress the value of shortening those things that were used most often. At a bare minimum, having gone from C<(?:xxx)> to C<[xxx]> saves me about 2-4 characters in my AVERAGE regexp. Also, that's m:i/^ (\+|-)? (\d* [\. \d*]? \d) (e [\+|-]? \d+)? $/ For what it's worth. This is not the same as your expression, but I'm assuming that you meant to capture groups that would make sense for later use (instead of capturing only part of the number). Otherwise, it's the same. One of the nice things that falls out of the Perl 6 patterns is that it's reasonable for every module to provide an export target that exports some of it's more commonly used rules. So you might say: use Math::IEEE :rules; while <> { if / (<ieee_float>) / { print "Floater: $1\n"; } } Which is certainly a lot cleaner than a big hairy pattern hanging in the middle of your code.... -- Aaron Sherman <[EMAIL PROTECTED]> http://www.ajs.com/~ajs