Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Programmatically forcing a regexp to fail

by mwah (Hermit)
on Oct 31, 2007 at 20:56 UTC ( [id://648361]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
     ...
     my @nums = 1 .. 30;
     my $reg = qr{^(\d+)$ (??{ $1 % 3 ? '(?!)' : '' })}x;
     print join ',', grep /$reg/, @nums;
     ...
    
  2. or download this
     ...
     my $reg = qr{ ^((?>\d+)) (??{ !!($1 % 3) and '(?!)' }) }x;
     ...
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://648361]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (7)
As of 2024-04-25 15:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found