kiat has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to have a regex to change the filenames on the left to the ones on the right:
1) mypic.jpg.jpg => mypic_jpg.jpg
2) mypic.jpg.jpg.jpg => mypic_jpg_jpg.jpg
2) fish.fish.gif => fish_fish.gif
Basically, I want to replace every dot but the last with an underscore.
I haven't had much luck yet so I don't have any code to show.
Could someone enlighten me?
Thanks in anticipation :)
Update: Thanks to all for your help :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Replace all occurrences but the last
by merlyn (Sage) on Aug 22, 2004 at 15:24 UTC | |
by kiat (Vicar) on Aug 22, 2004 at 15:27 UTC | |
|
Re: Replace all occurrences but the last
by ysth (Canon) on Aug 22, 2004 at 15:51 UTC | |
|
Re: Replace all occurrences but the last
by Aristotle (Chancellor) on Aug 22, 2004 at 18:35 UTC | |
|
Re: Replace all occurrences but the last
by ambrus (Abbot) on Aug 22, 2004 at 15:31 UTC | |
|
Re: Replace all occurrences but the last
by ambrus (Abbot) on Aug 22, 2004 at 16:31 UTC | |
|
Re: Replace all occurrences but the last
by Anonymous Monk on Aug 23, 2004 at 11:03 UTC | |
by Aristotle (Chancellor) on Aug 23, 2004 at 11:08 UTC |