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)$
For a range from 1950 to 2050 you may use the following regex:
^19[5-9]\d|20[0-4]\d|2050$
Online demo