RegEx for Date - Post ID 302212

User 2423414 Photo


Registered User
6 posts

Hi everybody,
I need a RegEx-Code for the german form of date in the formfield "Geburtsdatum".
The desired format is (for instance) 19.10.1964

I used a the following RegEx:
/^([0]?[1-9]|[1|2][0-9]|[3][0|1])[./-]([0]?[1-9]|[1][0-2])[.]([0-9]{4}|[0-9]{2})$/

But when the form should be submitted, the following Error is shown:
• Error validating RegEx magic field: Unknown modifier '-'

Unfortunately I'm not familiar with "RegEx", so that I don't know where the error is.

Any Help very appreciated. Thanks a lot.
Attachments:
User 2423414 Photo


Registered User
6 posts

Hi,
my problem is solved:
The working RegEx for german date is:
/^([0]?[1-9]|[1|2][0-9]|[3][0|1])[.]([0]?[1-9]|[1][0-2])[.]([0-9]{4}|[0-9]{2})$/
User 187934 Photo


Senior Advisor
20,227 posts

Thanks for updating with the solution.:cool:
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.