Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Perl6ish rules in Perl5's regex engine

by demerphq (Chancellor)
on Sep 10, 2006 at 15:02 UTC ( #572226=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    our $qr=qr/<(?:[<>\\]+|\\.|(??{$qr}))*>/;
    print "not " unless '<<><><<<>>><>>'=~/^($qr)$/;
    print "ok - $1\n";
    
  2. or download this
    print "not " unless '<<><><<<>>><>>'=~/^((?&:<(?:[<>\\]+|\\.|(?:&))*>)
    +)$/;
    print "ok - $1\n";
    
  3. or download this
    my $rules=qr/(?&& # compile this stuff, but dont match it
                 (&foo: .... ) # define ...
    ...
                 )
               /x;
    if ($blah=~/(&foo)(&bar)$rules/) { ... }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://572226]
Approved by BrowserUk
Front-paged by BrowserUk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2022-11-30 06:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?