Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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 wandering the Monastery: (6)
As of 2016-07-23 10:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?


















    Results (219 votes). Check out past polls.