Given the following input:
Invoice Date: {InvoiceDate(dd.mm.YYYY)}
Inoice Number: {InvoiceNumber}
I am trying to extract
- Match 1:
- InvoiceDate
- dd.mm.YYYY
- Match 2:
- InvoiceNumber
I got this regex working for the invoice Date:
\{([^}]+)\(([^)]+)\)\}
But obiously, (dd.mm.YYYY)
is not optional.
Then I tried this regex:
\{([^}]+)(?:\(([^)]+)\))?\}
Using (?:)?
syntax seems to ignore my inner captching group (dd.mm.YYYY)
So how can I make \(([^)]+)\)
optional?