End a filename after a certain character?

Advanced Renamer forum
#1 : 30/03-19 05:03
Posts: 1
I'm trying to write a script to end the filename after a specific character, ")" in this case, but I haven't written Java in over 10 years.. Anyone willing to assist?

30/03-19 05:03
#2 : 30/03-19 09:15
David Lee
David Lee
Posts: 444
You don't need to use scripting - a Replace method with a Regular Expression will achieve this.

Replace: (.*?\))(.*)
with: \1

This will truncate the filename after the first occurrence of ")"
If you omit the "?" then the first "*" quantifier will be "greedy" and a filename containing more than one ")" will be truncated after the final ")".

30/03-19 09:15