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 (
Here is a regex if you want to find a year in a film name for example. Years b/n 1900 - 2029 and some symbols are allowed wrapping the year .-_+[(
(?<=(?:\s|\.|_|\-|\+|\(|\[))(?:19[2-9]|20[0-2])\d(?=\s|$|\.|_|\-|\+|\)|\])
check it out here https://regex101.com/r/eQ9zK7/82
Note you can not start with year, because there is at least interval in front. In the example first few lines are matching, because we have multiple lines in a single line they wont match.
1917.2019.1080p... even if 1917 was in range it will mark only 2019