I have a long list of filenames with <variable length string>-<variable length string>-<variable length string>.ext, and I wish to replace the first "-" with "--" in all these filenames.
Can someone give me a hint on how to replace only the nth (in this case, the first) occurrence of a character (or string)?
Many thanks!
MRT: Search/Replace nth occurrence of a char or string.
Moderators: Hacker, petermad, Stefan2, white
Re: Search/Replace nth occurrence of a char or string.
This seems to do it for your example:
Search for:
Replace with:
[x]RegEx
Search for:
Code: Select all
(.+?)-(.+)
Code: Select all
$1--$2
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: Search/Replace nth occurrence of a char or string.
Brilliant! Many thanks!