Regex - Find numbers between 2000 and 3000

regex

Solution

How about

^2\d{3}|3000$

Or as Amarghosh & Bart K. & jleedev pointed out, to match multiple instances

\b(?:2[0-9]{3}|3000)\b

If you need to match `a3000` or `3000a` but not `13000`, you would need lookahead and lookbefore like

(?<![0-9])(?:2[0-9]{3}|3000)(?![0-9])

Problem

I have a need to search all numbers with 4 digits between 2000 and 3000. It can be that letters are before and after. I thought I can use `[2000-3000]{4}`, but doesnt work, why? thank you.

Original source