I need to match 'words' (string of characters with no spaces) that might have the word near at the beginning and/or the end and have only digits in the middle.
Examples: near3 4near near2near
It should not match words like nearing3 4nearsighted near3ness nearsighted
I tried this: x = re.match(r"((\bnear)|(near\b))(\d)", txt)
It works for this word: near3 and this word: near4near but not for this word 2near