I'm trying to get a match of 9-digit integer number. The text I'm scanning can be a length of 1-200 character.
The trouble I'm running in to is that I do not want to match if the input has a series of digits longer than 9. I also need to match if the whole input string is 9 digits. Or begins or ends with the 9-digit number.
I've tried:
d{9} > This matches sub-strings longer than 9 digits
d{9}(\D) > This works unless the sub-string is at the end since this expects some character after the 9 digits.
I have search a lot but I have not found this exact issue. Any ideas?
Note: I happen to be working with ColdFusion for this particular issue but I'm hoping that a general regex will do the trick. If necessary I can code this in CFML.