Skip to content

Instantly share code, notes, and snippets.

@JustinAzoff
Created November 8, 2011 20:28
Show Gist options
  • Save JustinAzoff/1349073 to your computer and use it in GitHub Desktop.
Save JustinAzoff/1349073 to your computer and use it in GitHub Desktop.
Generate a case insensitive regex for bro
#!/usr/bin/env python
import sys
phrase = sys.argv[1]
parts = [l + l.upper() for l in phrase.lower()]
regex = ''.join(['[%s]' % part for part in parts])
print regex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment