full unicode casefolding in Python (case-insensitive search for keywords)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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