Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

autrijus (1505)

autrijus
  (email not shown publicly)
http://pugs.blogs.com/

Journal of autrijus (1505)

Saturday March 19, 2005
11:42 AM

Day 47: Perl 5 regular expressions landed.

[ #23741 ]
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!

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.