I have input field for year and I need a regex for validation it. I have such code: ^([12]\\d)?(\\d\\d)$. But I want allow to validate only years in certain range (
^([12]\\d)?(\\d\\d)$
RegExp does not seem to be the right tool here. If you have the year values already isolated surely a simple comparison would work :
if (+yr >= 1990 && +yr <= 2010)
The +yr converts the string to a number
+yr