Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: [RFC] Building Regex Alternations Dynamically

by kcott (Archbishop)
on Jan 19, 2017 at 10:11 UTC ( [id://1179901]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $regex = join ...
    $regex = qr/...
    
  2. or download this
    $regex_base_str = join ...
    $regex_compiled = qr/...
    
  3. or download this
    # Simple case: OK - matches "a" or "b"
    $ perl -E 'my $re = "a|b"; $re = qr{$re}; say $re'
    ...
    # Complex case: OK - matches "a" or "b" [fixed with "(?:...)"]
    $ perl -E 'my $re = "(?:a|b)"; $re = qr{X${re}Y}; say $re'
    (?^u:X(?:a|b)Y)
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-03-29 00:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found