It has been a while for me with regex...

A swapping-ground for Regular Expression syntax

It has been a while for me with regex...

Postby JCN9801 » Mon Aug 12, 2019 11:12 pm

More than 20 years since I played in Unix...

Can I get a hint on how to bulk remove a filename suffix ending in -d -dd -ddd where the d=[0-9] digits. Example: MyVideo-01.mp4 to MyVideo.mp4

Also I would like to be able to reverse a suffix pattern: Specifically <filename>(tr)([A-Z][A-Z]).mp4 to be <filename>([A-Z][A-Z])(tr).mp4
without individually going through all of the [A-Z] patterns (about a dozen of them, e.g., MA, MB, LV, LR, LP, etc).

Finally Is there a way to filter for filenames that DO NOT contain a specific string: E.g., *(SCL-* all files NOT containing "(SCL-"

Thanks for helping a retired tech geezer,
---Jeff :D
JCN9801
 
Posts: 2
Joined: Mon Aug 12, 2019 10:52 pm

Re: It has been a while for me with regex...

Postby therube » Tue Aug 13, 2019 4:49 pm

1:RegEx
Code: Select all
Match:  (.*)(-\d{1,3})$
Replace:  \1


See if that will do what you need.
Match everything up to the first "-digit{1 to 3 times}".

---

Everything
Search: !SCL(

Then drag the files into BRU.

---

Better examples of your reverse issue?
therube
 
Posts: 603
Joined: Mon Jan 18, 2016 6:23 pm


Return to Regular Expressions