perl
|
|
Allison Randal, Damian Conway: Synopsis 5. "Just as you can have anonymous subs and named subs you can have anonymous regexes and named regexes:"
rule ident { [<alpha>|_] \w* } # and later... @ids = grep /<ident>/, @strings; # and then refer to named regexes, such as: rule serial_number { <[A-Z]> \d<8> } rule type { alpha | beta | production | deprecated | legacy }Neat and slightly shocking (for someone who's been doing Perl for eight years) syntax.