lightsystemdarkgreen
@ fde4946raw

1.13.2 (2026-11-17)

Bug fixes:

Enhancements:

Performance:

Documentation:

1.13.1 (2026-07-15)

This is a release that fixes a bug where incorrect regex match offsets could be reported. Note that this doesn’t impact whether a match occurs or not, just where it occurs. The match offsets are still valid for slicing, they just may not refer to the correct leftmost-first match. See #1364 for (many) more details.

Bug fixes:

1.13.0 (2026-07-09)

This release includes a new API, a regex! macro, for lazy compilation of a regex from a string literal. If you use regexes a lot, it’s likely you’ve already written one exactly like it. The new macro can be used like this:

use regex::regex;

fn is_match(line: &str) -> bool {
    // The regex will be compiled approximately once and reused automatically.
    // This avoids the footgun of using `Regex::new` here, which would
    // guarantee that it would be compiled every time this routine is called.
    // This would likely make this routine much slower than it needs to be.
    regex!(r"bar|baz").is_match(line)
}

let hay = "\
path/to/foo:54:Blue Harvest
path/to/bar:90:Something, Something, Something, Dark Side
path/to/baz:3:It's a Trap!
";

let matches = hay.lines().filter(|line| is_match(line)).count();
assert_eq!(matches, 2);

Improvements:

1.12.4 (2026-06-09)

This release includes a performance optimization for compilation of regexes with very large character classes.

Improvements:

1.12.3 (2026-02-03)

This release excludes some unnecessary things from the archive published to crates.io. Specifically, fuzzing data and various shell scripts are now excluded. If you run into problems, please file an issue.

Improvements:

1.12.2 (2025-10-13)

This release fixes a cargo doc breakage on nightly when --cfg docsrs is enabled. This caused documentation to fail to build on docs.rs.

Bug fixes:

1.12.1 (2025-10-10)

This release makes a bug fix in the new regex::Captures::get_match API introduced in 1.12.0. There was an oversight with the lifetime parameter for the Match returned. This is technically a breaking change, but given that it was caught almost immediately and I’ve yanked the 1.12.0 release, I think this is fine.

1.12.0 (2025-10-10)

This release contains a smattering of bug fixes, a fix for excessive memory consumption in some cases and a new regex::Captures::get_match API.

Improvements:

Bug fixes:

1.11.3 (2025-09-25)

This is a small patch release with an improvement in memory usage in some cases.

Improvements:

1.11.2 (2025-08-24)

This is a new patch release of regex with some minor fixes. A larger number of typo or lint fix patches were merged. Also, we now finally recommend using std::sync::LazyLock.

Improvements:

Bug fixes:

1.11.1 (2024-10-24)

This is a new patch release of regex that fixes compilation on nightly Rust when the unstable pattern crate feature is enabled. Users on nightly Rust without this feature enabled are unaffected.

Bug fixes:

1.11.0 (2024-09-29)

This is a new minor release of regex that brings in an update to the Unicode Character Database. Specifically, this updates the Unicode data used by regex internally to the version 16 release.

New features:

1.10.6 (2024-08-02)

This is a new patch release with a fix for the unstable crate feature that enables std::str::Pattern trait integration.

Bug fixes:

1.10.5 (2024-06-09)

This is a new patch release with some minor fixes.

Bug fixes:

1.10.4 (2024-03-22)

This is a new patch release with some minor fixes.

1.10.3 (2024-01-21)

This is a new patch release that fixes the feature configuration of optional dependencies, and fixes an unsound use of bounds check elision.

Bug fixes:

1.10.2 (2023-10-16)

This is a new patch release that fixes a search regression where incorrect matches could be reported.

Bug fixes:

1.10.1 (2023-10-14)

This is a new patch release with a minor increase in the number of valid patterns and a broadening of some literal optimizations.

New features:

Performance improvements:

1.10.0 (2023-10-09)

This is a new minor release of regex that adds support for start and end word boundary assertions. That is, \< and \>. The minimum supported Rust version has also been raised to 1.65, which was released about one year ago.

The new word boundary assertions are:

The \< and \> are GNU extensions to POSIX regexes. They have been added to the regex crate because they enjoy somewhat broad support in other regex engines as well (for example, vim). The \b{start} and \b{end} assertions are aliases for \< and \>, respectively.

The \b{start-half} and \b{end-half} assertions are not found in any other regex engine (although regex engines with general look-around support can certainly express them). They were added principally to support the implementation of word matching in grep programs, where one generally wants to be a bit more flexible in what is considered a word boundary.

New features:

Performance improvements:

Bug fixes:

regex-automata breaking change release:

This release includes a regex-automata 0.4.0 breaking change release, which was necessary in order to support the new word boundary assertions. For example, the Look enum has new variants and the LookSet type now uses u32 instead of u16 to represent a bitset of look-around assertions. These are overall very minor changes, and most users of regex-automata should be able to move to 0.4 from 0.3 without any changes at all.

regex-syntax breaking change release:

This release also includes a regex-syntax 0.8.0 breaking change release, which, like regex-automata, was necessary in order to support the new word boundary assertions. This release also includes some changes to the Ast type to reduce heap usage in some cases. If you are using the Ast type directly, your code may require some minor modifications. Otherwise, users of regex-syntax 0.7 should be able to migrate to 0.8 without any code changes.

regex-lite release:

The regex-lite 0.1.1 release contains support for the new word boundary assertions. There are no breaking changes.

1.9.6 (2023-09-30)

This is a patch release that fixes a panic that can occur when the default regex size limit is increased to a large number.

1.9.5 (2023-09-02)

This is a patch release that hopefully mostly fixes a performance bug that occurs when sharing a regex across multiple threads.

Issue #934 explains this in more detail. It is also noted in the crate documentation. The bug can appear when sharing a regex across multiple threads simultaneously, as might be the case when using a regex from a OnceLock, lazy_static or similar primitive. Usually high contention only results when using many threads to execute searches on small haystacks.

One can avoid the contention problem entirely through one of two methods. The first is to use lower level APIs from regex-automata that require passing state explicitly, such as meta::Regex::search_with. The second is to clone a regex and send it to other threads explicitly. This will not use any additional memory usage compared to sharing the regex. The only downside of this approach is that it may be less convenient, for example, it won’t work with things like OnceLock or lazy_static or once_cell.

With that said, as of this release, the contention performance problems have been greatly reduced. This was achieved by changing the free-list so that it was sharded across threads, and that ensuring each sharded mutex occupies a single cache line to mitigate false sharing. So while contention may still impact performance in some cases, it should be a lot better now.

Because of the changes to how the free-list works, please report any issues you find with this release. That not only includes search time regressions but also significant regressions in memory usage. Reporting improvements is also welcome as well! If possible, provide a reproduction.

Bug fixes:

1.9.4 (2023-08-26)

This is a patch release that fixes a bug where RegexSet::is_match(..) could incorrectly return false (even when RegexSet::matches(..).matched_any() returns true).

Bug fixes:

1.9.3 (2023-08-05)

This is a patch release that fixes a bug where some searches could result in incorrect match offsets being reported. It is difficult to characterize the types of regexes susceptible to this bug. They generally involve patterns that contain no prefix or suffix literals, but have an inner literal along with a regex prefix that can conditionally match.

Bug fixes:

1.9.2 (2023-08-05)

This is a patch release that fixes another memory usage regression. This particular regression occurred only when using a RegexSet. In some cases, much more heap memory (by one or two orders of magnitude) was allocated than in versions prior to 1.9.0.

Bug fixes:

1.9.1 (2023-07-07)

This is a patch release which fixes a memory usage regression. In the regex 1.9 release, one of the internal engines used a more aggressive allocation strategy than what was done previously. This patch release reverts to the prior on-demand strategy.

Bug fixes:

1.9.0 (2023-07-05)

This release marks the end of a years long rewrite of the regex crate internals. Since this is such a big release, please report any issues or regressions you find. We would also love to hear about improvements as well.

In addition to many internal improvements that should hopefully result in “my regex searches are faster,” there have also been a few API additions:

New features:

Performance improvements:

(There are many more performance improvements as well, but not all of them have specific issues devoted to them.)

Bug fixes:

1.8.4 (2023-06-05)

This is a patch release that fixes a bug where (?-u:\B) was allowed in Unicode regexes, despite the fact that the current matching engines can report match offsets between the code units of a single UTF-8 encoded codepoint. That in turn means that match offsets that split a codepoint could be reported, which in turn results in panicking when one uses them to slice a &str.

This bug occurred in the transition to regex 1.8 because the underlying syntactical error that prevented this regex from compiling was intentionally removed. That’s because (?-u:\B) will be permitted in Unicode regexes in regex 1.9, but the matching engines will guarantee to never report match offsets that split a codepoint. When the underlying syntactical error was removed, no code was added to ensure that (?-u:\B) didn’t compile in the regex 1.8 transition release. This release, regex 1.8.4, adds that code such that Regex::new(r"(?-u:\B)") returns to the regex <1.8 behavior of not compiling. (A bytes::Regex can still of course compile it.)

Bug fixes:

1.8.3 (2023-05-25)

This is a patch release that fixes a bug where the regex would report a match at every position even when it shouldn’t. This could occur in a very small subset of regexes, usually an alternation of simple literals that have particular properties. (See the issue linked below for a more precise description.)

Bug fixes:

1.8.2 (2023-05-22)

This is a patch release that fixes a bug where regex compilation could panic in debug mode for regexes with large counted repetitions. For example, a{2147483516}{2147483416}{5} resulted in an integer overflow that wrapped in release mode but panicking in debug mode. Despite the unintended wrapping arithmetic in release mode, it didn’t cause any other logical bugs since the errant code was for new analysis that wasn’t used yet.

Bug fixes:

1.8.1 (2023-04-21)

This is a patch release that fixes a bug where a regex match could be reported where none was found. Specifically, the bug occurs when a pattern contains some literal prefixes that could be extracted and an optional word boundary in the prefix.

Bug fixes:

1.8.0 (2023-04-20)

This is a sizeable release that will be soon followed by another sizeable release. Both of them will combined close over 40 existing issues and PRs.

This first release, despite its size, essentially represents preparatory work for the second release, which will be even bigger. Namely, this release:

The second release, which will follow ~shortly after the release above, will contain a soup-to-nuts rewrite of every regex engine. This will be done by bringing regex-automatagithub into this repository, and then changing the regex crate to be nothing but an API shim layer on top of regex-automata’s API.

These tandem releases are the culmination of about 3 years of on-and-off work that began in earnest in March 2020.

Because of the scale of changes involved in these releases, I would love to hear about your experience. Especially if you notice undocumented changes in behavior or performance changes (positive or negative).

Most changes in the first release are listed below. For more details, please see the commit log, which reflects a linear and decently documented history of all changes.

New features:

Performance improvements:

Bug fixes:

1.7.3 (2023-03-24)

This is a small release that fixes a bug in Regex::shortest_match_at that could cause it to panic, even when the offset given is valid.

Bug fixes:

1.7.2 (2023-03-21)

This is a small release that fixes a failing test on FreeBSD.

Bug fixes:

1.7.1 (2023-01-09)

This release was done principally to try and fix the doc.rs rendering for the regex crate.

Performance improvements:

Bug fixes:

1.7.0 (2022-11-05)

This release principally includes an upgrade to Unicode 15.

New features:

1.6.0 (2022-07-05)

This release principally includes an upgrade to Unicode 14.

New features:

Bug fixes:

1.5.6 (2022-05-20)

This release includes a few bug fixes, including a bug that produced incorrect matches when a non-greedy ? operator was used.

1.5.5 (2022-03-08)

This releases fixes a security bug in the regex compiler. This bug permits a vector for a denial-of-service attack in cases where the regex being compiled is untrusted. There are no known problems where the regex is itself trusted, including in cases of untrusted haystacks.

1.5.4 (2021-05-06)

This release fixes another compilation failure when building regex. This time, the fix is for when the pattern feature is enabled, which only works on nightly Rust. CI has been updated to test this case.

1.5.3 (2021-05-01)

This releases fixes a bug when building regex with only the unicode-perl feature. It turns out that while CI was building this configuration, it wasn’t actually failing the overall build on a failed compilation.

1.5.2 (2021-05-01)

This release fixes a performance bug when Unicode word boundaries are used. Namely, for certain regexes on certain inputs, it’s possible for the lazy DFA to stop searching (causing a fallback to a slower engine) when it doesn’t actually need to.

PR #768 fixes the bug, which was originally reported in ripgrep#1860.

1.5.1 (2021-04-30)

This is a patch release that fixes a compilation error when the perf-literal feature is not enabled.

1.5.0 (2021-04-30)

This release primarily updates to Rust 2018 (finally) and bumps the MSRV to Rust 1.41 (from Rust 1.28). Rust 1.41 was chosen because it’s still reasonably old, and is what’s in Debian stable at the time of writing.

This release also drops this crate’s own bespoke substring search algorithms in favor of a new memmem implementation provided by the memchr crate. This will change the performance profile of some regexes, sometimes getting a little worse, and hopefully more frequently, getting a lot better. Please report any serious performance regressions if you find them.

1.4.6 (2021-04-22)

This is a small patch release that fixes the compiler’s size check on how much heap memory a regex uses. Previously, the compiler did not account for the heap usage of Unicode character classes. Now it does. It’s possible that this may make some regexes fail to compile that previously did compile. If that happens, please file an issue.

1.4.5 (2021-03-14)

This is a small patch release that fixes a regression in the size of a Regex in the 1.4.4 release. Prior to 1.4.4, a Regex was 552 bytes. In the 1.4.4 release, it was 856 bytes due to internal changes. In this release, a Regex is now 16 bytes. In general, the size of a Regex was never something that was on my radar, but this increased size in the 1.4.4 release seems to have crossed a threshold and resulted in stack overflows in some programs.

1.4.4 (2021-03-11)

This is a small patch release that contains some bug fixes. Notably, it also drops the thread_local (and lazy_static, via transitivity) dependencies.

Bug fixes:

1.4.3 (2021-01-08)

This is a small patch release that adds some missing standard trait implementations for some types in the public API.

Bug fixes:

1.4.2 (2020-11-01)

This is a small bug fix release that bans \P{any}. We previously banned empty classes like [^\w\W], but missed the \P{any} case. In the future, we hope to permit empty classes.

1.4.1 (2020-10-13)

This is a small bug fix release that makes \p{cf} work. Previously, it would report “property not found” even though cf is a valid abbreviation for the Format general category.

1.4.0 (2020-10-11)

This releases has a few minor documentation fixes as well as some very minor API additions. The MSRV remains at Rust 1.28 for now, but this is intended to increase to at least Rust 1.41.1 soon.

This release also adds support for OSS-Fuzz. Kudos to @DavidKorczynski for doing the heavy lifting for that!

New features:

Bug fixes:

1.3.9 (2020-05-28)

This release fixes a MSRV (Minimum Support Rust Version) regression in the 1.3.8 release. Namely, while 1.3.8 compiles on Rust 1.28, it actually does not compile on other Rust versions, such as Rust 1.39.

Bug fixes:

1.3.8 (2020-05-28)

This release contains a couple of important bug fixes driven by better support for empty-subexpressions in regexes. For example, regexes like b| are now allowed. Major thanks to @sliquister for implementing support for this in #677.

Bug fixes:

1.3.7 (2020-04-17)

This release contains a small bug fix that fixes how regex forwards crate features to regex-syntax. In particular, this will reduce recompilations in some cases.

Bug fixes:

1.3.6 (2020-03-24)

This release contains a sizable (~30%) performance improvement when compiling some kinds of large regular expressions.

Performance improvements:

1.3.5 (2020-03-12)

This release updates this crate to Unicode 13.

New features:

1.3.4 (2020-01-30)

This is a small bug fix release that fixes a bug related to the scoping of flags in a regex. Namely, before this fix, a regex like ((?i)a)b) would match aB despite the fact that b should not be matched case insensitively.

Bug fixes:

1.3.3 (2020-01-09)

This is a small maintenance release that upgrades the dependency on thread_local from 0.3 to 1.0. The minimum supported Rust version remains at Rust 1.28.

1.3.2 (2020-01-09)

This is a small maintenance release with some house cleaning and bug fixes.

New features:

Bug fixes:

1.3.1 (2019-09-04)

This is a maintenance release with no changes in order to try to work around a docs.rs/Cargo issue.

1.3.0 (2019-09-03)

This release adds a plethora of new crate features that permit users of regex to shrink its size considerably, in exchange for giving up either functionality (such as Unicode support) or runtime performance. When all such features are disabled, the dependency tree for regex shrinks to exactly 1 crate (regex-syntax). More information about the new crate features can be found in the docs.

Note that while this is a new minor version release, the minimum supported Rust version for this crate remains at 1.28.0.

New features:

1.2.1 (2019-08-03)

This release does a bit of house cleaning. Namely:

In general, this is part of an ongoing (long term) effort to make optimizations in the regex engine easier to reason about. The current code is too convoluted, and thus it is very easy to introduce new bugs. This simplification effort is the primary motivation behind re-working the aho-corasick crate to not only bundle algorithms like Teddy, but to also provide regex-like match semantics automatically.

Moving forward, the plan is to join up with the bstr and regex-automata crates, with the former providing more sophisticated substring search algorithms (thereby deleting existing code in regex) and the latter providing ahead-of-time compiled DFAs for cases where they are inexpensive to compute.

1.2.0 (2019-07-20)

This release updates regex’s minimum supported Rust version to 1.28, which was release almost 1 year ago. This release also updates regex’s Unicode data tables to 12.1.0.

1.1.9 (2019-07-06)

This release contains a bug fix that caused regex’s tests to fail, due to a dependency on an unreleased behavior in regex-syntax.

1.1.8 (2019-07-04)

This release contains a few small internal refactorings. One of which fixes an instance of undefined behavior in a part of the SIMD code.

Bug fixes:

1.1.7 (2019-06-09)

This release fixes up a few warnings as a result of recent deprecations.

1.1.6 (2019-04-16)

This release fixes a regression introduced by a bug fix (for BUG #557) which could cause the regex engine to enter an infinite loop. This bug was originally reported against ripgrep.

1.1.5 (2019-04-01)

This release fixes a bug in regex’s dependency specification where it requires a newer version of regex-syntax, but this wasn’t communicated correctly in the Cargo.toml. This would have been caught by a minimal version check, but this check was disabled because the rand crate itself advertises incorrect dependency specifications.

Bug fixes:

1.1.4 (2019-03-31)

This release fixes a backwards compatibility regression where Regex was no longer UnwindSafe. This was caused by the upgrade to aho-corasick 0.7, whose AhoCorasick type was itself not UnwindSafe. This has been fixed in aho-corasick 0.7.4, which we now require.

Bug fixes:

1.1.3 (2019-03-30)

This releases fixes a few bugs and adds a performance improvement when a regex is a simple alternation of literals.

Performance improvements:

Bug fixes:

1.1.2 (2019-02-27)

This release fixes a bug found in the fix introduced in 1.1.1.

Bug fixes:

1.1.1 (2019-02-27)

This is a small release with one fix for a bug caused by literal optimizations.

Bug fixes:

1.1.0 (2018-11-30)

This is a small release with a couple small enhancements. This release also increases the minimal supported Rust version (MSRV) to 1.24.1 (from 1.20.0). In accordance with this crate’s MSRV policy, this release bumps the minor version number.

Performance improvements:

New features:

Bug fixes:

1.0.6 (2018-11-06)

This is a small release.

Performance improvements:

Bug fixes:

1.0.5 (2018-09-06)

This is a small release with an API enhancement.

New features:

1.0.4 (2018-08-25)

This is a small release that bumps the quickcheck dependency.

1.0.3 (2018-08-24)

This is a small bug fix release.

Bug fixes:

1.0.2 (2018-07-18)

This release exposes some new lower level APIs on Regex that permit amortizing allocation and controlling the location at which a search is performed in a more granular way. Most users of the regex crate will not need or want to use these APIs.

New features:

Bug fixes:

1.0.1 (2018-06-19)

This release upgrades regex’s Unicode tables to Unicode 11, and enables SIMD optimizations automatically on Rust stable (1.27 or newer).

New features:

Bug fixes:

1.0.0 (2018-05-01)

This release marks the 1.0 release of regex.

While this release includes some breaking changes, most users of older versions of the regex library should be able to migrate to 1.0 by simply bumping the version number. The important changes are as follows:

For more information and discussion, please see 1.0 release tracking issue.

0.2.11 (2018-05-01)

This release primarily contains bug fixes. Some of them resolve bugs where the parser could panic.

New features:

Bug fixes:

0.2.10 (2018-03-16)

This release primarily updates the regex crate to changes made in std::arch on nightly Rust.

New features:

0.2.9 (2018-03-12)

This release introduces a new nightly only feature, unstable, which enables SIMD optimizations for certain types of regexes. No additional compile time options are necessary, and the regex crate will automatically choose the best CPU features at run time. As a result, the simd (nightly only) crate dependency has been dropped.

New features:

Bug fixes:

0.2.8 (2018-03-12)

Bug fixes:

0.2.7 (2018-03-07)

This release includes a ground-up rewrite of the regex-syntax crate, which has been in development for over a year. 731 New features:

Bug fixes:

0.2.6 (2018-02-08)

Bug fixes:

0.2.5 (2017-12-30)

Bug fixes:

0.2.4 (2017-12-30)

New features:

Bug fixes:

0.2.3 (2017-11-30)

New features:

Bug fixes:

0.2.2 (2017-05-21)

New features:

Bug fixes:

0.2.1

One major bug with replace_all has been fixed along with a couple of other touch-ups.

0.2.0

This is a new major release of the regex crate, and is an implementation of the regex 1.0 RFCgithub. We are releasing a 0.2 first, and if there are no major problems, we will release a 1.0 shortly. For 0.2, the minimum supported Rust version is 1.12.

There are a number of breaking changes in 0.2. They are split into two types. The first type correspond to breaking changes in regular expression syntax. The second type correspond to breaking changes in the API.

Breaking changes for regex syntax:

Breaking changes for the regex API:

A number of bugs have been fixed:

0.1.80

0.1.79

0.1.78

0.1.77

0.1.76

0.1.75

0.1.74

0.1.73

0.1.72

0.1.71

0.1.70

0.1.69

0.1.68

0.1.67

0.1.66