I need to retrieve the date from a string. the output string is from a pdf and im verifying the date. the date is going to be different for each pdf. So I need to grab from the bottom “18 January 2019”
"CERTIFICATE of COMPLETION\r\nThis is to certify that\r\nname\r\nhas completed the course\r\nChild Protection Awareness Training\r\n18 January 2019\r\nPowered by TCPDF (www.tcpdf.org)"
There will also be different structures of the pdf where it doesnt grabbed all of the text and just name and date for e.g.
First Name Last Name\r\n2 September 2019\r\nPowered by TCPDF (www.tcpdf.org)"
So I need some help getting to the YEAR and then taking the whole date and cutting out anything else before that
\d is matching a single digit, ? means the character is optional, \w matches a word and \d{4} matches exactly 4 digits.
Check out a site like regexr to have a play around with what it’s doing. They have a cheatsheet on the left with the different symbols so you don’t have to know what they are straight away.
Here’s one with your sample: RegExr: Learn, Build, & Test RegEx
Check out the Explain tab down the bottom to see which part of the pattern is matching each part of your string.