Skip to content Skip to sidebar Skip to footer

JavaScript Regular Expression To Match X Digits Only

Can someone help my pea brain figure out why my simple regular expression is not working as I am expecting/wanting it to. I want to match a date format of MM/DD/YYYY with exactly 2

Solution 1:

need to specify start and end of string

/^\d{4}$/

Solution 2:


Post a Comment for "JavaScript Regular Expression To Match X Digits Only"