Regular Expressions help

I’m new to regular expressions and I’m trying to validate a date so that only dates from 2017 onwards are allowed to be selected. I found a regex online that works with my code, but I’m unsure as to what I change to get it so that it only accepts 2017. Also, it only works in Chrome. The validation doesn’t work in FireFox. Any way to fix that?

Any help is much appreciated, thank you. Apologies if this is in the wrong forum.


Regex doesn’t strike me as the best tool for this task. I’d use regex to find the date and then convert it to a Date object

If you’re intentionally looking to make things difficult for yourself then you should probably also solve it by yourself. To debug it you can to divide it into smaller parts to test individually and narrow down where the problem is. might be useful as an aid in reading the regex

1 Like