Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: changing only the first two matches of a regex

by larryl (Scribe)
on Mar 22, 2001 at 02:37 UTC ( #66172=note: print w/ replies, xml ) Need Help??


in reply to changing only the first two matches of a regex

Instead of removing the first two occurrences, why not just remove the first occurrence, twice?

s/(^|/)\d_//; s/(^|/)\d_//;


Comment on Re: changing only the first two matches of a regex
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (15)
As of 2015-07-02 13:39 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 (40 votes), past polls