Mike Hall wrote:
Liam, "re.compile("in (.*?)\b")" will not find any match in the example string I provided. I have had little luck with these non-greedy matchers.

"in (.*?)\b" will match against "in " because you use .* which will match an empty string. Try "in (.+?)\b" (or "(?<=\bin)..+?\b" )to require one character after the space.


The non-greedy match is very useful, if you can't get it to work ask for help.

I don't appear to have redemo.py on my system (on OSX), as an import returns an error. I will look into finding this module, thanks for pointing me towards it :)

You can't import it, you have to run it from the command line. I don't know if it is installed under Mac OSX though. You might be interested in RegexPlor:
http://python.net/~gherman/RegexPlor.html


Kent

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to