import reword = "8"pat = r'(?<!\S){0}(?!\S)'.format(re.escape(word))print re.search(pat,"nnn 8", flags=re.IGNORECASE)
Standard input is empty
<_sre.SRE_Match object at 0xb74704b8>
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!