My Question: I found this exercise very challenging. I'm kind stuck on the Date of Birth.
Challenge: Try to come up with the regular expressions to validate the following text strings (don't worry about case insensitivity):
I was able to come up for the first three names. But I'm stuck on the Date of Birth.
"^[a-z]{1,10}$", // First name
"^[a-z]$", // Middle initial
"^[a-z']{2,10}$", // Last name
Please help me.
For regex for dates, see the link: Regex Tutorial
But I think the example will work.
"^(0[1-9]|1[012])[-/.](0[1-9]|[12][0-9]|3[01])[-/.](19|20)\\d\\d$"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With