Skip to content



Backrefs is a wrapper around Python's built-in Re and the 3rd party Regex library. Backrefs adds various additional back references (and a couple other features) that are known to some regular expression engines, but not to Python's Re and/or Regex. The supported references actually vary depending on the regular expression engine being used as the engine may already have support for some, or things that prevent implementation of a feature.

Backrefs comes in two flavors: bre (a Re wrapper) and bregex (a Regex wrapper).


There are a couple of recommended ways to install Backrefs.

  1. Install with pip:

    $ pip install backrefs
  2. Install with optional requirement regex:

    $ pip install backrefs[extras]
  3. Install locally from source via:

    $ python build
    $ python install
  4. If developing Backrefs, you can install via:

    $ pip install --editable .

    This method will allow you to instantly see your changes without reinstalling which is great for developing.

Last update: May 21, 2022
Back to top