Sunday, May 6, 2012

Python flavored regex

Don't expect all flavors of regular expressions to be the same. For example, one difference between Java and Python, Java allows "unions" of character class by nesting.


is the same as


but Python's re module will only interpret the latter.

There is an alternative module on pypi called regex that may replace re, which handles nested sets.

Fork me on GitHub