fork(1) download
  1. import re
  2.  
  3. some_var = "what what"
  4.  
  5. should_match = "what what what what what what hey"
  6. not_a_match = "what what what what hey what what"
  7.  
  8. match = re.search(r"(?:\s*{0}){{3}}".format(re.escape(some_var)), should_match)
  9. no_match = re.search(r"(?:\s*{0}){{3}}".format(re.escape(some_var)), not_a_match)
  10.  
  11. print match
  12. print no_match
Success #stdin #stdout 0.02s 9016KB
stdin
Standard input is empty
stdout
<_sre.SRE_Match object at 0xb7515a30>
None