The best way to remove punctuation doesn't use regular expressions.
# Python 3
import string
transmapping = str.maketrans(None, None, string.punctuation)
t1 = 'hello, how are you ?'
t2 = t1.translate(transmapping).strip()
Here are the Python3 docs for str.maketrans
and str.translate
# Python 2
import string
t1 = 'hello, how are you ?'
t2 = t1.translate(None, deletechars=string.punctuation).strip()
Here are the Python2 docs for string.maketrans
(not used here) and str.translate
Using regular expressions to do string translation is a bit like using a backhoe when a prybar would do. It's huge, unwieldy, and likely to foul things up if you don't do it juuuust right.