in reply to Matching date range with pure regex
use strict; while (<DATA>) { chomp; print "$_ is ", /^(?:19|20) (?: (?:(?<=19)[5-9]|(?<=20)[0-4])[0-9] | 50)$ /x ? "Ok" : "not ok", "\n" } __DATA__ 1050 1950 2050 2054 1980 2004 3100 [download]