public
Created

full unicode casefolding in Python (case-insensitive search for keywords)

  • Download Gist
casefold.py
Python
1 2 3 4 5
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']

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.