Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

The 'g' modifier in compiled regex

by naikonta (Curate)
on Apr 09, 2007 at 03:11 UTC ( [id://608925]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $pat = '(' . join('|', @patterns) . ')';
    $pat = qr/$pat/i;
    
  2. or download this
    $pat = qr/$pat/gi;
    s/$pat/something/;
    
  3. or download this
    $pat = qr/$pat/i;
    s/$pat/something/g;
    
  4. or download this
    perl -e 'print if /perl/gi'
    
  5. or download this
    $str = 'nothing but perl can parse Perl';
    @match = $str =~ /(perl)/gi;
    print for @match;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://608925]
Approved by friedo
Front-paged by friedo
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-04-19 18:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found