fork download
  1. import re
  2.  
  3. p = re.compile(r'(?:(?<=^)|(?<=\s))' + '8' + r'(?=\s|$)', flags=re.IGNORECASE|re.M)
  4. test_str = "nnn 8 8-88"
  5.  
  6. print re.search(p, test_str).group()
Success #stdin #stdout 0.01s 8968KB
stdin
Standard input is empty
stdout
8