fork(2) download
  1. import re
  2.  
  3. def findWholeWord(w1,w2):
  4. return re.compile(r'\b{0}(?:\W+\w+){{0,10}}\W+{1}\b'.format(w1,w2), flags=re.IGNORECASE).search
  5.  
  6. test_str = "A Hello, World! program is a computer program that outputs \"Hello, World!\" on a display device. Being a very simple program in most programming languages, it is often used to illustrate to beginning programmers the basic syntax for constructing a working program. It is also used to verify that a language or system is operating correctly."
  7. print(findWholeWord('hello', 'simple'))
  8.  
Success #stdin #stdout 0.01s 9016KB
stdin
Standard input is empty
stdout
<built-in method search of _sre.SRE_Pattern object at 0xb74fa3c8>