I unpack (using unzip.exe) a set of PDF files with the following structure:
nnnc.pdf --> pdf-nnn-000.pdf (I can solve this within a batch file, with FOR %%variable, REN and another REN)
nnns.pdf --> pdf-nnn-003.pdf (I can solve this within a batch file, with FOR %%variable, REN and another REN)
pdf-nnn-(p)(p)p.pdf --> pdf-nnn-ppp.pdf (with leading zeroes).
So:
pdf-123-7.pdf should become pdf-123-007.pdf
pdf-123-42.pdf should become pdf-123-042.pdf
pdf-123-179.pdf should become pdf-123-179.pdf
Where "nnn" is some number that indicates that these PDF's belong together.
The goal is to merge the files with the same nnn to one complete PDF (I'll use a nice command line tool for that: "cpdf").
and "p" is the page number, therefore (p)(p)p, as there is always a page number, but it is 1, 2 or 3 digits big.
123c.pdf and 123s.pdf is a different story, but I can solev that, when it complicates things, in an alternative way.
Sounds like I need to use, it's all from the commandline as it needs to happen among other things in a batch file, a regular expression.
I'm not familiar with RegEx and tried for hours, but the syntaxis is not completely clear to me.
I found a RegEx-trainerhttps://regex101.com/#pcre) and was able to setup a RegEx for a start:
pdf-(.*)-(.*)\.pdf
If the example is pdf-321-56.pdf, then my idea was to sort od strip and store the code ("nnn") and the page number ("(p)(p)p").
This seems to work.
I'd now expect to end up "321" in variable \1 and "56" in \2.
Therefore I tried the command:
BRC32 /REGEXP:pdf-(.*)-(.*)\.pdf:pdf-\1-\2.pdf
But BRC indicates that nothing needs to be remaned; that sounds like there is no match at all...
Cab someone please help me with the RegEx and the syntax of BRC?