Hello
I can find successfully a date in the document DD.MM.YY or DD.MM.YYYY
\d{2}\.\d{2}\.\d{2}(?:\d{2})?
and save it to Date1
I can name the Document %[RegExp:Date1] %[FileName]
DD.MM.YYYY SoAndSo.pdf
But i need the filename of the document to be
YYYY MM DD SoAndSo.pdf
The Tooltip in RegExp says:
"You can use found text in the actions for saving documents
and changing document settings using the macro syntax
%[RegExp:Date1]. To reference a group in a hit to
, use the syntax %[RegExp:Date1.Index]"
Some of my unsuccessful trys
%[RegExp:Date1.3] %[RegExp:Date1.2] %[RegExp:Date1.1] %[FileName]
%[RegExp:Date1.2] %[RegExp:Date1.1] %[RegExp:Date1.0] %[FileName]
What is the correct syntax ??
RegEx date as YYMMDD in Save Documents
Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Stefan - PDF-XChange
-
- User
- Posts: 75
- Joined: Thu Nov 30, 2017 1:24 pm
Re: RegEx date as YYMMDD in Save Documents
Hello Rgegges,
1. To refer to different parts of a date, you need to define a matching group for each part of interest by enclosing the group pattern in parentheses.
2. You should use a comma, not a dot, when referring to a matched group in a macro expression:
but not
I suggest the following regular expression to match a date:
It has three matching groups:
(\d{2}) - two-digit number (DD)
(\d{2}) - two-digit number (MM)
(\d{4}|\d{2}) - either a two-digit or four-digit number (YY or YYYY). Note: It's important to put \d{4} before \d{2} to ensure four-digit years are matched first.
Then, for the Filename option in the Save Documents action, use the following expression:
I've attached a ZIP with the tool export with all necessary options configured — feel free to test it and adjust it to your needs.
or you can take a look at the screenshot of the tool settings:
Best regards,
1. To refer to different parts of a date, you need to define a matching group for each part of interest by enclosing the group pattern in parentheses.
2. You should use a comma, not a dot, when referring to a matched group in a macro expression:
Code: Select all
%[RegExp:Date1,1]
Code: Select all
%[RegExp:Date1.1]
Code: Select all
(\d{2})\.(\d{2})\.(\d{4}|\d{2})
(\d{2}) - two-digit number (DD)
(\d{2}) - two-digit number (MM)
(\d{4}|\d{2}) - either a two-digit or four-digit number (YY or YYYY). Note: It's important to put \d{4} before \d{2} to ensure four-digit years are matched first.
Then, for the Filename option in the Save Documents action, use the following expression:
Code: Select all
%[RegExp:Date1,3] %[RegExp:Date1,2] %[RegExp:Date1,1] %[FileName]
You do not have the required permissions to view the files attached to this post.
Vladimir Goshko
Software Developer
PDF-XChange Co. LTD
Software Developer
PDF-XChange Co. LTD