I\'ve got a string that may or may not contain a number of 4 or 5 digits. I\'m looking for a regex that can detect if the string does in fact have such a number.
The foolproof one to avoid longer numbers would be:
([^\d]|^)\d{4,5}([^\d]|$)
I'm assuming you don't want to allow for a comma after the thousands digit? If you do then:
([^\d]|^)\d{1,2},\d{3}([^\d]|$)
Perhaps
\d{4,5}
?