If the dates of birth and loss are always in the exact format Month Day, Year
then what you’ve come up with should generally work, with one major exception: using \d
for Day
will only match single digit days, and cause the action to fail for days with two digits. Fortunately, this is an easy fix. Again, assuming that dates are always going to be in this exact format, here’s how I would write the regex:
Date of Birth: (\w+ \d{1,2}, \d{4})
(I’ve used “Date of Birth” as the example here, but the same exact regex should also work for “Date of Loss”)