I am trying create a regex pattern to check a string containing two years spearated by '-' where year B = year A + 1 and these dates are between 2000 and 2099 (date starting by 20)
For now I have a regex expression like this /^20[0-9]{2}-20[0-9]{2}$ it's/g but i don't know how to add a rule like "year B = year A - 1"
I would like to have these results when I do a preg_match :
2009-2010 -> true
2019-2020 -> true
2020-2021 -> true
1999-2000 -> false
2001-2099 -> false
2013-2020 -> false
2099-2100 -> false
2000-2100 -> false