NOT (Pattern) in RegEx

Advanced Renamer forum
#1 : 08/01-23 02:36
Posts: 74
I am comfortable enough with RegEx, at least in the scope of using them within ARen.

But either ARen does not support it, or I have no idea how to incorporate applying a method to all files that DO NOT match a pattern.

For example, I have a lot of files that match the pattern (\w+-\d{4}) and a few that do not and I want to add an underscore at the start of the files that do not match the pattern.

I tried [^(\w+-\d{4})] but ARen gives an "Invalid Reg Ex" error.

Now, I know I can filter out the files matching the pattern while loading files into ARen by entering the pattern at the Add Folder Dialogue Box and ticking 'Not Matching', but then I would have to enter this pattern every time I need to do this, and day after day, it gets really old.

If there is a way to save it as a method, then it makes things easier. I know I am being a little lazy, but I am also being practical, I believe.

Anyway, any help in entering NOT RegEx expressions in a method would be greatly appreciated.

08/01-23 02:36
#2 : 08/01-23 09:03
David Lee
David Lee
Posts: 1071
Try matching the beginning of the filename ("^") with a negative lookahead:

Replace: ^(?!\w+-\d{4})
with: _
Use regular expressions

08/01-23 09:03