Skip to content

Instantly share code, notes, and snippets.

@zed
Created January 26, 2012 02:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save zed/1680518 to your computer and use it in GitHub Desktop.
full unicode casefolding in Python (case-insensitive search for keywords)
import regex # pip install regex
keywords = ['post', 'another']
p = regex.compile(ur'(?fi)\L<keywords>', keywords=keywords)
p.findall(u'POST, Post, post, poſt, post, and poſt')
# -> [u'POST', u'Post', u'post', u'po\u017ft', u'po\ufb06', u'po\ufb05']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment