Skip to content

Instantly share code, notes, and snippets.



Last active Dec 25, 2015
What would you like to do?
regex punctuation class
import re
punctexp = re.compile(r"[\!\"\#\$\%\&\\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\\\]\^_\`\{\|\}\~]")
# Could also…
# import string
# re.compile('[{0}]'.format(re.escape(string.punctuation)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment