Deutsch English Français Italiano |
<veumlu$3gfsk$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!feeds.phibee-telecom.net!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: jak <nospam@please.ty> Newsgroups: comp.lang.python Subject: Re: Correct syntax for pathological re.search() Date: Sat, 19 Oct 2024 00:15:23 +0200 Organization: A noiseless patient Spider Lines: 16 Message-ID: <veumlu$3gfsk$1@dont-email.me> References: <ve0o34$1nep4$1@dont-email.me> <MQaOO.3313338$EVn.2054758@fx04.ams4> <011301db1c22$5e7519c0$1b5f4d40$@gmail.com> <20241012105958.cbctekv7vustleha@hjp.at> <966b510d-9bd7-4472-a858-7e042d78461d@tompassin.net> <20241018210941.f5azh2lvz7cxzcy5@hjp.at> <mailman.28.1729285790.4695.python-list@python.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sat, 19 Oct 2024 00:15:27 +0200 (CEST) Injection-Info: dont-email.me; posting-host="16693d41b040f8f50b178df3596c546e"; logging-data="3686292"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+w6GW1pT4Kt3OwPJMjo+Bz" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 SeaMonkey/2.53.19 Cancel-Lock: sha1:8ohf2fkSeK+nR/CQ+KjoqXnl4+M= In-Reply-To: <mailman.28.1729285790.4695.python-list@python.org> Bytes: 2004 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 )