You are not logged in.
Pages: 1
Example:
"file_name_v20_6_5_some_text.txt" to "file_name_v20.6.5_some_text.txt"
I tried the following regex replace but it fails:
(\d)_(\d)
$1.$2
Thanks
Last edited by crane (2015-04-07 12:42)
Offline
Hi crane and welcome.
This is because the regex engine didn't find another "(\d)_(\d)" match after the "20_6", there only is "_5_some_text.txt" remaining.
This would be different for a file name like "file_name_v20_6_some_6_5_text.txt"
The simplest solution for you is to duplicate the rule (right click the rule and chose 'Duplicate Rule')
One is for the "20_6" and the other for the "6_5" part in a second pass.
1) RegEx: Replace expression "(\d)_(\d)" with "$1.$2" (skip extension)
2) RegEx: Replace expression "(\d)_(\d)" with "$1.$2" (skip extension)
- - -
Another solution, depending on the file names, would this single RegEx rule:
1) RegEx: Replace expression "_(\d)" with ".$1" (skip extension)
.
Last edited by Stefan (2015-04-07 18:14)
Read the *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)
Offline
Also, this handy PascalScript will do the job.
It will work for any number of sets of digits, no need to duplicate the rule.
var
I: Integer;
begin
for I := 2 to Length(FileName) - 1 do
if FileName[i] = '_' then
if IsWideCharDigit(FileName[I-1]) then
if IsWideCharDigit(FileName[I+1]) then
FileName[i] := '.';
end.
Offline
Pascal script is working fine.
Thanks
Offline
Pages: 1