How to remove the last part of file names using RegEx in lazy mode?

Advanced Renamer forum
#1 : 19/11-23 10:24
Narayan
Posts: 3
I have file names that end with the following pattern:
<string1> - <string2> - <string3> press

I wanted to remove the " - <string3> press" part at the end.

I tried to use the "Remove Pattern" rule, and specified the following string:
- *press

In normal mode, the file names are not affected at all.
In RegEx mode, AR ends up removing " - <string2> - <string3> press" because of greedy matching.

How do I force the RegEx engine to match in lazy mode?
I tried adding a ? to force lazy mode, like this:
- *?press

But it did not change the result.

Please help!
#2 : 19/11-23 18:24
Miguel
Posts: 163
Reply to #1: Hi.
Try this .

Text to be replaced: ^(.+)-.+$
Replace with: $1
Occurrence : All
Use regular expressions
Aply to name

I hope that work


#3 : 19/11-23 18:59
Narayan
Posts: 3
Reply to #2:

Thanks for the rapid solution!
It works.

That said, is there a formula to force lazy mode in RegEx?
It would be nice to know that method for future needs.

edited: 19/11-23 19:05