[Tutor] redemo.py and r'python\.org'

Alan Gauld alan.gauld at freenet.co.uk
Thu Oct 13 23:09:19 CEST 2005


Hi Dick,

> I've begun to try out redemo.py to test and learn regular expressions. It 
> doesn't seem to accept Python's raw strings as raw strings, e.g., 
> r'python\.org'  for matching  python.org  and nothing else. Am I correct, 
> or is there something I don't understand here?

I might be getting confused but are you trying to use the raw string
as your regex? I don't think you can do that, the re module will consider
the regex as a raw string.

In other words if you want to match pyhon.org just use 'python\.org'
with no 'r' in front.

Does that help or have I misunderstood the problem?

Alan G
Author of the learn to program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld




More information about the Tutor mailing list