Re: Questions about regex

2009-05-30 Thread Rob Williscroft
wrote in news:fe9f707f-aaf3-4ca6-859a-5b0c63904fc0 @s28g2000vbp.googlegroups.com in comp.lang.python: > text = re.sub('(\<(/?[^\>]+)\>)', "", text)#remove the HTML > Python has a /r/ (raw) string literal type for regex's: text = re.sub( r'(\<(/?[^\>]+)\>)', "", text ) In raw strings p

Re: Questions about regex

2009-05-30 Thread Steven D'Aprano
On Fri, 29 May 2009 11:26:07 -0700, Jared.S.Bauer wrote: > Hello, > > I'm new to python and I'm having problems with a regular expression. I > use textmate as my editor and when I run the regex in textmate it works > fine, but when I run it as part of the script it freezes. Could anyone > help me

Re: Questions about regex

2009-05-30 Thread bearophileHUGS
Jared.S., even if a regex doesn't look like a program, it's like a small program written in a strange language. And you have to test and comment your programs. So I suggest you to program in a more tidy way, and add unit tests (doctests may suffice here) to your regexes, you can also use the verbos

Re: Questions about regex

2009-05-29 Thread Bobby
On May 29, 1:26 pm, jared.s.ba...@gmail.com wrote: > Hello, > > I'm new to python and I'm having problems with a regular expression. I > use textmate as my editor and when I run the regex in textmate it > works fine, but when I run it as part of the script it freezes. Could > anyone help me figure

Questions about regex

2009-05-29 Thread Jared . S . Bauer
Hello, I'm new to python and I'm having problems with a regular expression. I use textmate as my editor and when I run the regex in textmate it works fine, but when I run it as part of the script it freezes. Could anyone help me figure out why this is happening and how to fix it. Here is the scrip