Hi, I'm trying to extract the day, month and year from some string values. The month will be Jan, Feb, Mar... etc, but the RegEx statement I have is only returning the last letter of the month. Any ideas would be greatly appreciated.
Sample Data
Payment was made on the 15 - Feb, 2021 |
Payment is due on 1st - Feb, 2021 |
Payment was made on the 13 - Dec, 2021 |
Payment was made on the 14th - Dec, 2021 |
Due on the 15 Dec 2021 |
Ignore this one due on the 15 Xyz 2021 |
The RegEx statement I have is...
.*(?<!\d)(\d{1,2})[st|nd|rd|th]?.*([Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec]),?\s(\d{4}).*
Thanks
Solved! Go to Solution.
Hi @markcurry
You just don't need the brackets:
.*(?<!\d)(\d{1,2})[st|nd|rd|th]?.*(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec),?\s(\d{4}).*
Best,
mmenth
@mmenth thanks a million, that did the trick.