Re: Re: backslashes and r-strings r"abc"

Greg Ewing <[email protected]> Mon, 02 Aug 2004 13:01:27 +1200
Newsgroups gmane.comp.lang.prothon.user
Message-ID <[email protected]>
> Oh, I understand now.  He is pre-checking to make sure the string will be
> legal later when used in the regex.

No, there's no pre-checking going on. The way backslashes are treated
in r-strings just happens to be what you want for regular expressions,
that's all.

Leonard is pointing out that being able to include a backslash-quote
in an r-string is not useless, because it's exactly what you want for
including a quote in an RE. Similarly, the inability to end with a
backslash is not a disadvantage in an RE.

So it seems I spoke slightly too soon when I said that being able
to include backslash-quote but not quote was useless.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
[email protected]	   +--------------------------------------+