Regex extract date after specific word

Good evening,

I looking extract a date after a specific wording from a string. I am able to isolate where the text is but have been unsuccessful with extracting exactly what i need. Any assistance would be much appreciated. Below is the date looking to extract along with the regex pattern i have currently.

Example: Dose given on October 28,2022

Regex Pattern: (?<=Dose given on \s)\b jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|\d{4}|\d{1-2}))\w*[\t\ \/.,;:-+_]+(\d{1,2}|jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\w*[\t\ \/.,;:-+_]+(\d{4}|\d{1,2})\w*\b

Hi,

How about the following expression?

System.Text.RegularExpressions.Regex.Match(yourString,"(?<=Dose\s+given\s+on\s+)(January|February|March|April|May|June|July|August|September|October|November|December)\s+\d{1,2}\s*,\s*\d{4}")

Sequence.xaml (5.4 KB)

Regards,

Regex Pattern:
1.(?<=Dose given on\s+)([A-Za-z\s0-9,0-9]+)
OR
2.(?<=Dose given on\s+).*

Hi @Dave_White

Use the below regex expression to extract the required data.
image

Hope it helps!!

Hi @Dave_White

Try this-

Dose given on\s+(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec|\d{1,2})\w*[\t /.,;:-+]+(\d{1,2})\w*[\t /.,;:-+]+(\d{4})

Thanks!!

Thank you all for all the help. I was able to resolve it with the solutions you provided.