例如:
import re
pattern = r"(.+) \1"
match = re.match(pattern, "word word")
if match:
   print ("Match 1")
match = re.match(pattern, "?! ?!")
if match:
   print ("Match 2")    
match = re.match(pattern, "abc cde")
if match:
   print ("Match 3")
结果:
>>> Match 1 Match 2 >>>