in reply to Identifying 3 or 4 digits

look for the 4 digits unless it has a dash after it

There's a good reference in the monastery. You want negative look-ahead. I also recommend not using \d. Under Unicode there are MANY numbers that will match that do not conform to the 0..9 I think you expect.

/\b[0-9]{4}\b(?!-)/

Replies are listed 'Best First'.
Re^2: Identifying 3 or 4 digits
by htmanning (Friar) on Apr 04, 2018 at 22:43 UTC
    Thank you! This worked.