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


Comment on Re: "exact" pattern matching
Download Code

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 cooling their heels in the Monastery: (8)
As of 2015-07-04 13:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls