3 ms·
I did a double take upon seeing "The regex module in Python is really old by now" and had to make sure it's talking about the current re module! re was introduc
by fulafel 11y ago
I did a double take upon seeing "The regex module in Python is really old by now" and had to make sure it's talking about the current re module! re was introduced alongside the older regex module around Python 1.5, the latter was finally removed in Python 2.5.
- andreasvc 11y agoAdditionally there's a newer module also named 'regex': https://pypi.python.org/pypi/regex https://pypi.python.org/pypi/regex
- rspeer 11y agoAnd this newer 'regex' is actually really good at tricky cases such as matching word boundaries. (An apostrophe or a non-ASCII character is not necessarily a word boundary!)
- andreasvc 11y ago> An apostrophe or a non-ASCII character is not necessarily a word boundary! I don't see how a regular expression library could help with that (other than proper Unicode support), because word boundaries are a language-specific, linguistic problem; i.e., you will need to supply a list of possible contractions anyway. Tokenization of natural language text may appear like a straightforward and solved problem, but there are actually lots of messy details to get right.