escape sequences and string comparisons

Moshe Zadka moshez at zadka.site.co.il
Wed Jan 10 09:37:16 EST 2001


On Tue, 09 Jan 2001 12:57:18 GMT, jkndeja at my-deja.com wrote:

> To which I reply:
> 	- Serves me right for not RTFM ... ;-/
> 	- not sure that I'm convinced by the debugging argument
> 	- I still think this makes re.escape() less useful than it
> might be. How about a function which turns a string into an 'escaped'
> form such that it would be an 'exact' RE match with itself?

Do you have any evidence that the following does not hold:

for any strings s and t, re.compile(re.escape(s)).search(t) is true iff
s is a substring of t?
-- 
Moshe Zadka <sig at zadka.site.co.il>
This is a signature anti-virus. 
Please stop the spread of signature viruses!




More information about the Python-list mailing list