Skip to main content

pyre2

Summary

pyre2 is a Python extension that wraps Google’s RE2 regular expression library. It implements many of the features of Python’s built-in re module with compatible interfaces.

New Features

  • Regexp objects have a fullmatch method that works like match, but anchors the match at both the start and the end.

  • Regexp objects have test_search, test_match, and test_fullmatch methods that work like search, match, and fullmatch, but only return True or False to indicate whether the match was successful. These methods should be faster than the full versions, especially for patterns with capturing groups.

Missing Features

  • No substitution methods.

  • No flags.

  • No split, findall, or finditer.

  • No top-level convenience functions like search and match. (Just use compile.)

  • No compile cache. (If you care enough about performance to use RE2, you probably care enough to cache your own patterns.)

  • No lastindex or lastgroup on Match objects.

Current Status

pyre2 has only received basic testing, and I am by no means a Python extension expert, so it is quite possible that it contains bugs. I’d guess the most likely are reference leaks in error cases.

RE2 doesn’t build with fPIC, so I had to bulid it with

make CFLAGS='-fPIC -c -Wall -Wno-sign-compare -O3 -g -I.'

I also had to add it to my compiler search path when building the module with a command like

env CPPFLAGS='-I/path/to/re2' LDFLAGS='-L/path/to/re2/obj' ./setup.py build

Contact

You can file bug reports on GitHub, or email the author: David Reiss <dreiss@facebook.com>.

Metadata

Release files for fb-re2 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fb-re2 1.0.2
File Size Uploaded
fb-re2-1.0.2.tar.gz 7.7 kB Details

Release files / fb-re2-1.0.2.tar.gz

Download URL fb-re2-1.0.2.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d5b960a2fa7e47dd58cb41d7e30abb75d49c46a25459356a095e2bb438b4e47c
BLAKE2b-256 checksum
How to use checksums
f64766d9d8ee34bd4130a7239a92a67714b9f6ad32ed67ca9bf9ecc0685aabf7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

1.0.7

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

This release

1.0.2 This release

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page