import re
# Greedy
s = '<html><head><title>Title</title></head></html>'
print(re.match('<.*>', s))
print(re.match('<.*?>', s))
Résultat de l'exécution:
<re.Match object; span=(0, 46), match='<html><head><title>Title</title></head></html>'>
<re.Match object; span=(0, 6), match='<html>'>
Recommended Posts