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

Re: "exact" pattern matching

by spacebat (Beadle)
on Jun 10, 2008 at 02:13 UTC ( #691138=note: print w/replies, xml ) Need Help??


in reply to "exact" pattern matching

I agree with CountZero, it sounds like you want index() to get the starting position of the substring, then you can use substr() as an lvalue to assign your replacement string.

However this sounds like what regular expressions were designed for, so either quotemeta() or the following may be a better fit:

s/\Q$pattern\E/$replacement/g

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2016-09-26 00:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (474 votes). Check out past polls.