fork download
  1. import re
  2.  
  3. strings = [
  4. "hello",
  5. "hwqrtedfasdlcvdaltbto",
  6. "test",
  7. "helliiiiio",
  8. "helhcludoo",
  9. "test helo",
  10. "kdjhslfjhshhhheeellllllooooosadsf"
  11. ]
  12.  
  13. for x in strings:
  14. if re.match(r'.*?h[^e]*e[^l]*l[^l]*l[^o]*o',x):
  15. print ('YES for %s' % x)
  16. else:
  17. print ('NO for %s' % x)
Success #stdin #stdout 0.01s 27712KB
stdin
Standard input is empty
stdout
YES for hello
YES for hwqrtedfasdlcvdaltbto
NO for test
YES for helliiiiio
YES for helhcludoo
NO for test helo
YES for kdjhslfjhshhhheeellllllooooosadsf