Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Perl6ish rules in Perl5's regex engine

by demerphq (Chancellor)
on Sep 10, 2006 at 15:02 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-26 00:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found