Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: How does this regex not match?

by Anonymous Monk
on Feb 13, 2010 at 07:47 UTC ( [id://822990]=note: print w/replies, xml ) Need Help??


in reply to How does this regex not match?

Basic regex syntax, brackets create a character class
use re 'debug'; my $orig = 'my_stuff[1]=400'; my $want = 'my_stuff[1]='; print "They Match\n" if $orig =~ /$want/; __END__ Compiling REx "my_stuff[1]=" Final program: 1: EXACT <my_stuff1=> (8) 8: END (0) anchored "my_stuff1=" at 0 (checking anchored isall) minlen 10 Guessing start of match in sv for REx "my_stuff[1]=" against "my_stuff +[1]=400" Did not find anchored substr "my_stuff1="... Match rejected by optimizer Freeing REx: "my_stuff[1]="
you want /\Q$want\E/ or substr

Replies are listed 'Best First'.
Re^2: How does this regex not match?
by Anonymous Monk on Feb 13, 2010 at 08:13 UTC
    not substr, but eq or index

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://822990]
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: (3)
As of 2026-02-07 13:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.