Day 47: Perl 5 regular expressions landed.

autrijus on 2005-03-19T16:42:37

Jesse arrives in 6 hours, so I'll keep this short.

Today I asked on #perl6 which one should I do first: Perl 5 regex (via PCRE), or a Perl 6 to C compiler (via Template Haskell)? pjcj suggested that the former is more practical, so I went with it. I'm glad to report that it now works, with full $/ as arrayref and $0 $1 $2 etc capturing magic.

The beginning of RRegex.hs in Pugs now reads:

A king he was on carven throne
In many-pillared halls of stone
With golden roof and silver floor,
And runes of power upon the door...

To wit:

pugs> "(balanced)" ~~ rx:perl5{^(\()?[^()]+(?(1)\))$};
bool::true
pugs> "(unbalanced" ~~ rx:perl5{^(\()?[^()]+(?(1)\))$};
bool::false

Much thanks to John Meacham of hs-regex and Philip Hazel of PCRE for their excellent libraries. Now the runes are with us, 6.0.12 draws near. Stay tuned!