Sujet : Re: Correct syntax for pathological re.search()
De : nospam (at) *nospam* please.ty (jak)
Groupes : comp.lang.pythonDate : 19. Oct 2024, 00:15:23
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <veumlu$3gfsk$1@dont-email.me>
References : 1 2 3 4 5 6 7
User-Agent : Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 SeaMonkey/2.53.19
Peter J. Holzer ha scritto:
As a trivial example, the regular expressions r"\sout{" and r"\sout\{"
are equivalent (the \ before the { is redundant). Yet
re.compile(s).pattern preserves the difference between the two strings.
Hi,
Allow me to be fussy: r"\sout{" and r"\sout\{" are similar but not
equivalent. If you omit the backslash, the parser will have to determine
if the graph is part of regular expression {n, m} and will take more
time. In some online regexs have these results:
r"\sout{" : 1 match ( 7 steps, 620 μs )
r"\sout\{" : 1 match ( 7 steps, 360 μs )