Re: re.sub question (regular expressions)

2009-10-20 Thread Chris Seberino
On Oct 16, 9:51 am, MRAB wrote: > What do you mean "blow up"? It worked for me in Python v2.6.2. My bad. False alarm. This was one of those cases where a bug in another area appears like a bug in a different area. Thank for the help. cs -- http://mail.python.org/mailman/listinfo/python-list

Re: re.sub question (regular expressions)

2009-10-16 Thread MRAB
Chris Seberino wrote: What does this line do?... input_ = re.sub("([a-zA-Z]+)", '"\\1"', input_) Why don't you try it? Does it remove parentheses from words? e.g. (foo) -> foo ??? No, it puts quotes around them. I'd like to replace [a-zA-Z] with \w but \w makes it blow up. In other word

Re: re.sub question (regular expressions)

2009-10-16 Thread Jean-Michel Pichavant
Chris Seberino wrote: What does this line do?... input_ = re.sub("([a-zA-Z]+)", '"\\1"', input_) Does it remove parentheses from words? e.g. (foo) -> foo ??? I'd like to replace [a-zA-Z] with \w but \w makes it blow up. In other words, re.sub("(\w+)", '"\\1"', input_) blows up. Why? cs

re.sub question (regular expressions)

2009-10-16 Thread Chris Seberino
What does this line do?... input_ = re.sub("([a-zA-Z]+)", '"\\1"', input_) Does it remove parentheses from words? e.g. (foo) -> foo ??? I'd like to replace [a-zA-Z] with \w but \w makes it blow up. In other words, re.sub("(\w+)", '"\\1"', input_) blows up. Why? cs -- http://mail.python.org/m