pavan474 has asked for the wisdom of the Perl Monks concerning the following question:
Hi All,
I have requirement to search and replace some URL's existing in files(may be XML's, text files e.t.c.,) with their equivalents
The URL's are like:
http://www.abc.com
Equivalent :: http://www.test.com
http://www.abc.com/test
http://www.abc.com/test2
Now i am taking all these URL's and their equivalents in a hash with key as URL and value as equivalent URL and comparing each file for each URL and replacing
The issue is i have some other URLS in the files which will satisfy the above condition i.e., for Ex: http://www.abc.com/perl/test/
When i go for search and replace of URL http://www.abc.com it is replacing the above new one(i.e.,ttp://www.abc.com/perl/test/) which shouldn't happen
Can you guy's please suggest a better approach for this
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: URL search and replace in the files (updated)
by haukex (Archbishop) on Dec 09, 2016 at 12:40 UTC | |
|
Re: URL search and replace in the files
by FreeBeerReekingMonk (Deacon) on Dec 09, 2016 at 20:34 UTC | |
|
Re: URL search and replace in the files
by 1nickt (Canon) on Dec 09, 2016 at 11:18 UTC |