I have been using Bulk Rename utility and I have been having some issues. I have some files named things like 664722.pdf
,664762.pdf
, and 664722-1.pdf
that I need to rename. The problem is I have to rename about 50 of these at a time.
So, I am converting from the top to the bottom row.
664722.pdf 664762.pdf 664722-1.pdf
664722-LabelProof.pdf 664762-LabelProof.pdf 664722-1-LabelProof.pdf
So, right now I have to do ([0-9]{6})(-[0-9])?
and name the files to \1\2-LabelProof
and THEN drop back to ([0-9]{6})(-[0-9])?
and name the files to \1-LabelProof
I am on windows.
Is anyone able to come up with a Regex that can match both 664722 AND 664722-1 at the same time and I can still call something to convert both jobs with and without subs to have -LabelProof at the end.
I thought about matching something like .pdf to replace it with -LabelProof.pdf, but it wont just be these PDFs. These are just the new ones and I have to leave all of the other ones alone.
Best Answer
Use
([0-9]{6}(-[0-9])?)\.pdf
and replace with\1-LabelProof.pdf
. This will make it so that\1
includes everything before.pdf
, on both files with and without dash and a number.This matches a six numbers in a row, then matches a dash and a number in the form
-3
either 0 or 1 times. Basically six numbers and then a- number
if it is there.