Quantcast
Viewing latest article 20
Browse Latest Browse All 935

How to validate is number is valid year or not by RegEx

suppose number is 2009 or 2019 and it is a valid year but 19 is not valid year. so how could i validate a number is valid year not by RegEx. i found a code and it is working but i am not being able to understand the Regex used there.

if (Regex.IsMatch("2019", "^(19|20)[0-9][0-9]"))
{}

what is the meaning of 19 or 20 used there ?

why two [0-9] set is used there ?

please help me to understand the RegEx. thanks


Viewing latest article 20
Browse Latest Browse All 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>