I am trying to test True if my string “deed” will have “numbers or a blank” in the first 9 characters.
deed = "4472 0438 (N/A Online)$0"
I have tried the following, and several variations but always get back a True, when I try it on string that would should not return a True. So there is something I am doing wrong.
re.search("([\. 0-9]{0,6})",deed)
Any suggestions would be greatly appreciated! Sorry, brand new to Regex.. but learning.
Try the following regular expression
The expression
"(^[ 0-9]{9})"locates the string at beginning of the line and only match if the first 9 characters are either numubers or blanks.