fork download
  1. import re
  2.  
  3. s = """
  4. <contentID>1"""
  5. reg = re.compile("(.|\n)+<contentID>1.*")
  6. m = reg.fullmatch(s)
  7. print(m)
  8. reg = re.compile(".*<contentID>1.*", re.DOTALL) # not [.\n]
  9. m = reg.fullmatch(s)
  10. print(m)
Success #stdin #stdout 0.02s 9936KB
stdin
Standard input is empty
stdout
<_sre.SRE_Match object; span=(0, 17), match='\n    <contentID>1'>
<_sre.SRE_Match object; span=(0, 17), match='\n    <contentID>1'>