Removing all punctuation with Regex

01 Oct 2018

even for people who don’t understand regex like me - this is still the fastest way to clean up a string with punctuation.

it replaces not word characters or spaces with empty string - see here for full answer from stackoverflow:

import re
s = "string. (With.) Punctuation?"
s = re.sub(r'[^\w\s]','',s)