Skip to content

Instantly share code, notes, and snippets.

@natereed
Created December 9, 2015 17:02
Show Gist options
  • Save natereed/ad81589dc081c9eb2342 to your computer and use it in GitHub Desktop.
Save natereed/ad81589dc081c9eb2342 to your computer and use it in GitHub Desktop.
Make a regex from an input string
import re
text = '''Information to be included in statements filed
pursuant to Rule 13d-1 (b) (c) and (d) and Amendments thereto
filed pursuant to Rule 13d-2 (b).'''
text = text.replace('(', '\(')
text = text.replace(')', '\)')
text = re.sub(r'\s+', '\s+', text)
text = re.sub(r'\.', '\.', text)
print text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment