my $digits_4 = qr{ (?<![\/-\ \w]) \d{4} (?![\/-\ \w]) }xms; [download]
untested...
In reply to Re^3: Recognizing 3 and 4 digit number by tybalt89 in thread Recognizing 3 and 4 digit number by htmanning