re2

Python wrapper for Google's RE2 using Cython
Download

re2 Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Price:
  • FREE
  • Publisher Name:
  • Mike Axiak
  • Publisher web site:
  • http://axiak.net

re2 Tags


re2 Description

Python wrapper for Google's RE2 using Cython re2 is a Python module that wraps Google's RE2 regular expression library.This version of pyre2 is similar to the one you'd find at facebook's github repository except that the stated goal of this version is to be a drop-in replacement for the re module.Backwards CompatibilityThe stated goal of this module is to be a drop-in replacement for re. My hope is that some will be able to go to the top of their module and put:try: import re2 as reexcept ImportError: import reThat being said, there are features of the re module that this module may never have. For example, RE2 does not handle lookahead assertions ((?=...)). For this reason, the module will automatically fall back to the original re module if there is a regex that it cannot handle.However, there are times when you may want to be notified of a failover. For this reason, I'm adding the single function set_fallback_notification to the module. Thus, you can write:try: import re2 as reexcept ImportError: import reelse: re.set_fallback_notification(re.FALLBACK_WARNING)And in the above example, set_fallback_notification can handle 3 values: re.FALLBACK_QUIETLY (default), re.FALLBACK_WARNING (raises a warning), and re.FALLBACK_EXCEPTION (which raises an exception). Requirements: · Python


re2 Related Software