in reply to Renames files and directories but won't update files at the same time.
What happens if you turn off the non-greediness in:
if ( /(.*?)$old_hostname(.*?)/i )
{
s/(.*?)$old_hostname(.*?)/$1$new_hostname$2/sgi;
}
by saying something like
if ( /(.*)$old_hostname(.*)/i )
{
s/(.*)$old_hostname(.*)/$1$new_hostname$2/sgi;
}
In this way it will match your prior regexp.Also, it would have been helpful if you wrote what the output is in the first run of your code.
Also, according to those who know a lot about regexes, saying .* is actually bad as this regexp is very expensive. When you have the time, take a look around the fine Tutorials we have on the monastery. This helped me a lot with the regexes.
Good luck.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Renames files and directories but won't update files at the same time.
by Arien (Pilgrim) on Aug 27, 2002 at 12:46 UTC |