I want to do preg replace in CGI. I have a string with URL like "www.example.com/data/example.cgi?name=example". I want to write a script which will replace "/data/example.cgi" from above url to "/example.php"
A:
$string=~ s//data\/example.cgi/example.php/g
This is what i did and works fine.... You can follow this link for details http://www.regular-expressions.info/perl.html
daron
2010-07-01 21:07:21
Caution: you should note that the answer has a backslash-front slash combo. On my screen it looks like an upper case V, and I was wondering why you would add a V? Maybe I am the only one that dumb, but I thought I'd point it out, just in case.
MJB
2010-07-01 21:27:47