How to NOT change the last part of a file?

Advanced Renamer forum
#1 : 04/02-23 06:41
Rikard Österman
Rikard Österman
Posts: 1
I've just stumbled upon this great program, but I just don't understand all these regular expressions and stuff. I've been looking at the forum but still don't understand how to solve my problem.

Is there a way to NOT change, or to protect the last part of a filename, when using the "New Name" feature ?

Example: "Light_IC1848_300.0s_Bin1_20230202-220946_-19.9C_0001.fit"

I want to change the first part, but the "-19.9C_0001.fit" should always stay the same as the original.
The total length of the filename is not always the same.

"I_want_to_change_this_part_but_not_the_last_part-19.9C_0001.fit"



04/02-23 06:41 - edited 04/02-23 07:09
#2 : 04/02-23 09:00
David Lee
David Lee
Posts: 1125
There is a good basic intro to regular expressions in the User Guide: https://www.advancedrenamer.com/user_guide/regul ar_expresions

If we assume that the text that you wish to keep is always in the format "-19.9C_0001" ie a string commencing with "-" then you can use "-" as a separator.

Try a Replace method...

Replace: .*(-[^-]*$)
with: New_Text\1
Use regular expressions




04/02-23 09:00