regex help

r0g aioe.org at technicalbloke.com
Wed Dec 16 12:22:25 EST 2009


Gabriel Rossetti wrote:
> Hello everyone,
> 
> I'm going nuts with some regex, could someone please show me what I'm
> doing wrong?
> 
> I have an XMPP msg :
> 
<snip>
> 
> 
> Does someone know what is wrong with my expression? Thank you, Gabriel




Gabriel, trying to debug a long regex in situ can be a nightmare however
the following technique always works for me...

Use the interactive interpreter and see if half the regex works, if it
does your problem is in the second half, if not it's in the first so try
the first half of that and so on an so forth. You'll find the point at
which it goes wrong in a snip.

Non-trivial regexes are always best built up and tested a bit at a time,
the interactive interpreter is great for this.

Roger.



More information about the Python-list mailing list