Delete up to Character

A swapping-ground for Regular Expression syntax

Delete up to Character

Postby SnickleFritz285 » Tue Jan 02, 2018 9:25 pm

I have a huge list of file names i need to rename to get them working in a 3D CAD program again. The filenames look like this:

14131-90_5_ass_any_A_1_270680.asm
14131-90_5_ass_any_A_2_270839.asm

The A represents the revisions, The 1 or 2 represent the file version, and the last digit is a randomly generated number that is not always the same amount of digits.

I want to start by deleting from the right side before the extension to the underscore to get rid of the random generated number.

I need them to look like this for example:
14131-90_5_ass_any_A_1.asm
14131-90_5_ass_any_A_2.asm

Ultimately, i want the file looking like this so i can open them without any errors and it opens the latest revision and version:
14131-90_5_ass_any.asm

Any help is appreciated
SnickleFritz285
 
Posts: 3
Joined: Tue Jan 02, 2018 9:07 pm

Re: Delete up to Character

Postby Admin » Wed Jan 03, 2018 12:29 am

Match: (.*)_
Replace: \1
Admin
Site Admin
 
Posts: 2343
Joined: Tue Mar 08, 2005 8:39 pm

Re: Delete up to Character

Postby SnickleFritz285 » Wed Jan 03, 2018 2:52 pm

Thank you
SnickleFritz285
 
Posts: 3
Joined: Tue Jan 02, 2018 9:07 pm


Return to Regular Expressions