manishrathi has asked for the wisdom of the Perl Monks concerning the following question:
When I create a new page "new", I want to replace alt="eway-logo" with alt="new-logo"
and src="/images/global/logo-eway.gif" with src="/images/global/new-eway.gif"
I have applied following logic fo that.
$file_content$u =~ s/logo-(.*)\.gif/logo-$cloneName\.gif/g ;
Code in the beginning is replaced with
generic-logo" src="/images/global/logo-generic
While I should get the code
<img class="left" alt="generic-logo" src="/images/global/generic-eway.gif"> </img>
I am not sure, why is it replacing
<img class="left" alt="when I have applied exact location, where it should start from.
Its also removing
.gif">
How can I get correct output ? Can someone please suggest whats wrong in this regex code ?
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regex is not working properly
by wind (Priest) on Jun 24, 2011 at 08:33 UTC | |
|
Re: regex is not working properly
by moritz (Cardinal) on Jun 24, 2011 at 08:41 UTC | |
|
Re: regex is not working properly
by bart (Canon) on Jun 24, 2011 at 08:58 UTC |