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 )

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to