Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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