Re: [Regexes] Stripping puctuation from a text

2008-05-23 Thread Andrew Lee
shabda raaj wrote: I want to strip punctuation from text. So I am trying, p = re.compile('[a-zA-Z0-9]+') p.sub('', 'I love tomatoes!! hell yeah! ... Why?') ' !! ! ... ?' Which gave me all the chars which I want to replace. So Next I tried by negating the regex, p = re.compile('^[a-zA-Z0

[Regexes] Stripping puctuation from a text

2008-05-22 Thread shabda raaj
I want to strip punctuation from text. So I am trying, >>> p = re.compile('[a-zA-Z0-9]+') >>> p.sub('', 'I love tomatoes!! hell yeah! ... Why?') ' !! ! ... ?' Which gave me all the chars which I want to replace. So Next I tried by negating the regex, >>> p = re.compile('^[a-zA-Z0-9]+') >>> p