Can you please help me to make perl regexp to replace
(http://.+) to http://www.my1.com/redir?$1
but do nothing for urls like http://www.my1.com/ or http://my1.com/
For instance I need to replace
http://whole.url.site.com/foo.htm to http://www.my1.com/redir?http://whole.url.site.com/foo.htm
http://www.google.com to http://www.my1.com/redir?http://www.google.com
but leave http://www.my1.com/index.php untached.
Thanks a lot!
It’s probably not a good idea but it can be done:
Result:
As Brian points out in a comment it won’t work with URLs that don’t end in ‘/’. I’m not sure if you want to rewrite that URL or not. As I said in my comment to your question, you really need to be more precise on what you are trying to do and why you need to use regular expressions for this task.