Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: How to make only two of three substitutions?

by bigj (Monk)
on Oct 15, 2002 at 15:18 UTC ( [id://205397]=note: print w/replies, xml ) Need Help??


in reply to How to make only two of three substitutions?

Another way, expressing the logic, that the first / mustn't removed, but all others is to say it explizitly.
Assuming the sql statement is one line $sql:
1 while $sql =~ s%(/.*)/%$1%gs;
or with the futuring keep syntax:
use Regexp::Keep; # I believe, it will be unnecessary on Perl 5.10 1 while $sql =~ s%/.*\K/%%gs;

Greetings,
Janek

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-25 12:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found