I am new to Regex and am trying to create a basic date pattern for a text input field in HTML.
For now I only want to consider the following rules:
- first number group with 2 digits from 01 to 31
- second number group with 2 digits from 01 to 12
- third number group with 4 digits from 1961 to 2100
- separator after first and second number group must be a dot / period
Allowed examples:
- 01.12.1990
- 04.05.2000
- 31.12.2010
I tried the following but this does not work for me.
Can someone tell me what I am missing here ?
My Regex pattern:
pattern="[01-31].[01-12].[1961-2100]"
Update:
pattern
in my case is the HTML pattern attribute not a variable in JS.
Many thanks in advance,
Tom