I was solving something and I found this test and I do not understand well what is happening.
Doubt is, it shows me 3456'7 'Why does 7 appear on the exit if I am delimiting [3-6]
?
What is prevailing over the limit that I put in brackets?
sentencia = 'Esto es la prueba 123456789 \n de expresiones regulares en python.'
#sentencia = 'Esto.'
pa = re.compile(r'[3-6]\d\d\d\d')
siesta = pa.finditer(sentencia)
for sies in siesta:
print(sies)
DEPARTURE:
<_sre.SRE_Match object; span=(20, 25), match='34567'> Process returned 0 (0x0) execution time : 0.057 s Presione una tecla para continuar . . .