#1 : 03/08-22 00:13
Hi, I have a lot of files like this;
England_20_Pound Sterling note 1999_1.jpg
England_20_Pound Sterling note 1999_2.jpg
And this is what I'm trying to do:
England 20_Pound Sterling note 1999_1.jpg
England 20_Pound Sterling note 1999_2.jpg
The idea is to replace all underscores with spaces except the last one. I'm dealing with RegEx but I cannot find the way.
I'll appreciate any help.
03/08-22 00:13 - edited 03/08-22 17:53
#2 : 04/08-22 11:04
Use a "Lookahead" to match only an underscore if it is not followed by a string containing another one.
Use regular expressions
See https://www.regular-expressions.info/lookaround. html
but note that Lookbehind is not supported in Perl Compatible Regex.
04/08-22 11:04 - edited 04/08-22 12:03
#3 : 04/08-22 19:13
Reply to #2:
Thank you very much David! That worked!
Also, the link you provided, explains Lookahead in detail (I couldn't find in this page in support section).