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

Re^2: [RFC] Building Regex Alternations Dynamically (updated x2)

by haukex (Archbishop)
on Jan 19, 2017 at 15:18 UTC ( [id://1179921]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @values = qw/ a ab. d ef def g|h /;
    my $regex_str = join '|',             # 4.
    ...
        @values;                          # 1.
    my $regex = qr/$regex_str/;           # 5.
    print "$regex\n";                     # 6.
    
  2. or download this
    (?^:ab\.|def|g\|h|ef|a|d)
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-03-28 08:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found