[Tutor] MemoryError

Kent Johnson kent37 at tds.net
Fri Dec 10 13:50:25 CET 2004

Well, that's a regex only a mother could love. :-) I can see why you were happy to find the 
(?P<text>) form of grouping.

You should compile textObj and urlObj outside of getVals. You could just pull the four lines that 
create textObj and urlObj outside of the function (into global scope). You just have to compile a 
regex once, then you can use it multiple times. Compiling is relatively slow so pulling it out of 
the loop is an optimization.

Congrats on getting this working!

Liam Clarke wrote:
> Hi Kent, 
> Thanks for the help, it worked third time around!
> The final product is here if you have an interest  - 
> http://www.rafb.net/paste/results/XCYthC70.html
> But, I think I found a new best friend for this sort of thing - 
> (?P<text>.*?)
> Being able to label stuff is brilliant.
> But yeah, thanks for the help, especially that sub method.
> Regards,
> Liam Clarke

More information about the Tutor mailing list