Next | Regular Expression Mastery | 67 |
Perl has a (deserved) reputation for having too much punctuation
A lot of that reputation is based on Perl's regex syntax
But a lot of the regex syntax was inherited from Ken Thompson's original design
He used up all the brackets for things like quantification
All that was left were things like (?:...)
Perl 6 will completely overhaul its regex syntax
Patterns will become much more like BNF grammars
They will efficiently incorporate other patterns as sub-parts:
rule octet { \d <1,3> } rule ip_address { <octet> [ \. <octet> ]<3> }
Traditional-style constructions will continue to be supported:
$ip_address = /\d<1,3>[\.\d<1,3>]<3>/;
As will the old notation:
$ip_address = m:p5/\d{1,3}(?:\.\d{1,3}){3}/;
See http://www.perl.com/lpt/a/2002/06/04/apo5.html for the fascinating details
Next | Copyright © 2002 M. J. Dominus |