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

Re: regex for case insensitive

by marinersk (Priest)
on May 31, 2017 at 06:50 UTC ( [id://1191671]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    use strict;
    ...
        print "<br>";
        }
    }
    
  2. or download this
    S:\Steve\Dev\PerlMonks\P-2017-05-31@0243-RegEx-Case-Insensitive>perl r
    +egex0a.pl
    Unrecognized escape \i passed through in regex; marked by <-- HERE in 
    +m/\i <-- HERE 1\-2\ Steps\i/ at regex0a.pl line 12.
    ...
    <br><br>Couldn't find [catch] anywhere!
    <br>
    S:\Steve\Dev\PerlMonks\P-2017-05-31@0243-RegEx-Case-Insensitive>
    
  3. or download this
    my $needle_regex = quotemeta $needle;
    if ($haystack =~ /$needle_regex/i) {
    
  4. or download this
    my @needles   = ("1-2 Steps", "5-7 Steps", "8-10 Steps", "catch");
    my @haystacks = ("move 1-2 steps", "move 8-10 steps to hoist", "catch 
    +the ball");
    ...
            print "<br>";
        }
    }
    
  5. or download this
    if ($haystack =~ /\Q$needle\E/i) {
    
  6. or download this
    my @needles   = ("1-2 Steps", "5-7 Steps", "8-10 Steps", "catch");
    my @haystacks = ("move 1-2 steps", "move 8-10 steps to hoist", "catch 
    +the ball");
    ...
            print "<br>";
        }
    }
    

Log In?
Username:
Password:

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

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

    No recent polls found