The $dir_pw_third_party/re2/ module provides build files to allow optionally including upstream RE2.

Using upstream RE2#

If you want to use RE2, you must do the following:


Add RE2 to your workspace with the following command.

git submodule add \


  • Set the GN var dir_pw_third_party_re2 to the location of the RE2 source.

    If you used the command above, this will be //third_party/re2/src

    This can be set in your or .gn file like: dir_pw_third_party_re2 = "//third_party/re2/src"


The GN build files are generated from the third-party Bazel build files using $dir_pw_build/py/pw_build/

The script uses data taken from $dir_pw_third_party/re2/repo.json.

The script should be re-run whenever the submodule is updated or the JSON file is modified. Specify the location of the Bazel repository can be specified using the -w option, e.g.

python pw_build/py/pw_build/ \
  -w third_party/re2/src


The update script was last run for revision c9cba76.