469,949 Members | 2,697 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,949 developers. It's quick & easy.

RegExp Question

I would like to make a small script to do the following.

replace a / with a - in the following situation
it is between a []
and not following a ://

so [bob/susan] becomes [bob-susan]

but [http://server/directory/file.html] stays the same

Any helps is greatly appreciated.
Jul 19 '05 #1
1 1331
Mark Friedgan wrote:
I would like to make a small script to do the following.

replace a / with a - in the following situation
it is between a []
and not following a ://

so [bob/susan] becomes [bob-susan]

but [http://server/directory/file.html] stays the same


s{(\[[^\]]*://[^\]]*\])|(\[[^\]]+])}{
if ($1) { $1 } else { (my $tmp = $2) =~ tr!/!-!; $tmp }
}eg;

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by python_charmer2000 | last post: by
19 posts views Thread by Magnus Lie Hetland | last post: by
5 posts views Thread by Lukas Holcik | last post: by
3 posts views Thread by Sped Erstad | last post: by
2 posts views Thread by Bill McCormick | last post: by
26 posts views Thread by Matt Kruse | last post: by
7 posts views Thread by Csaba Gabor | last post: by
11 posts views Thread by HopfZ | last post: by
8 posts views Thread by Darryl Kerkeslager | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.