Hi pavan474,
It sounds to me like your regexp might be something like s/www\.abc\.com/www.test.com/g (please show your code!), which is indeed a bit too simple. Please see Re^5: Grab input from the user and Open the file, where I showed how to use Regexp::Common to match full URLs and URI to parse them, and in your case you could use that same module to exchange the hostname.
Update: Upon rereading your post it sounds like you're not just exchanging hostnames in the URLs, but the same idea applies - use Regexp::Common to search for the full URLs and replace with whatever you like. Also, as I mention in the post I linked to, note that Regexp::Common does not match the #fragment part of URLs, so if you've got those you may need the alternate solution I presented.
Update 2: You mention XML files. Please note that a simple search/replace regex on an XML file may not be a good idea, as you could potentially modify parts of the file you don't want changed, or break its syntax. When dealing with XML/HTML, it's usually better to use an appropriate parser - see here and here for examples.
Hope this helps,
-- Hauke D
Minor Update: Clarified wordings.
In reply to Re: URL search and replace in the files (updated)
by haukex
in thread URL search and replace in the files
by pavan474
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |