3 This releases fixes a bug when building regex with only the `unicode-perl`
4 feature. It turns out that while CI was building this configuration, it wasn't
5 actually failing the overall build on a failed compilation.
7 * [BUG #769](https://github.com/rust-lang/regex/issues/769):
8 Fix build in `regex-syntax` when only the `unicode-perl` feature is enabled.
13 This release fixes a performance bug when Unicode word boundaries are used.
14 Namely, for certain regexes on certain inputs, it's possible for the lazy DFA
15 to stop searching (causing a fallback to a slower engine) when it doesn't
18 [PR #768](https://github.com/rust-lang/regex/pull/768) fixes the bug, which was
19 originally reported in
20 [ripgrep#1860](https://github.com/BurntSushi/ripgrep/issues/1860).
25 This is a patch release that fixes a compilation error when the `perf-literal`
26 feature is not enabled.
31 This release primarily updates to Rust 2018 (finally) and bumps the MSRV to
32 Rust 1.41 (from Rust 1.28). Rust 1.41 was chosen because it's still reasonably
33 old, and is what's in Debian stable at the time of writing.
35 This release also drops this crate's own bespoke substring search algorithms
37 [`memmem` implementation provided by the `memchr` crate](https://docs.rs/memchr/2.4.0/memchr/memmem/index.html).
38 This will change the performance profile of some regexes, sometimes getting a
39 little worse, and hopefully more frequently, getting a lot better. Please
40 report any serious performance regressions if you find them.
45 This is a small patch release that fixes the compiler's size check on how much
46 heap memory a regex uses. Previously, the compiler did not account for the
47 heap usage of Unicode character classes. Now it does. It's possible that this
48 may make some regexes fail to compile that previously did compile. If that
49 happens, please file an issue.
51 * [BUG OSS-fuzz#33579](https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=33579):
52 Some regexes can use more heap memory than one would expect.
57 This is a small patch release that fixes a regression in the size of a `Regex`
58 in the 1.4.4 release. Prior to 1.4.4, a `Regex` was 552 bytes. In the 1.4.4
59 release, it was 856 bytes due to internal changes. In this release, a `Regex`
60 is now 16 bytes. In general, the size of a `Regex` was never something that was
61 on my radar, but this increased size in the 1.4.4 release seems to have crossed
62 a threshold and resulted in stack overflows in some programs.
64 * [BUG #750](https://github.com/rust-lang/regex/pull/750):
65 Fixes stack overflows seemingly caused by a large `Regex` size by decreasing
71 This is a small patch release that contains some bug fixes. Notably, it also
72 drops the `thread_local` (and `lazy_static`, via transitivity) dependencies.
76 * [BUG #362](https://github.com/rust-lang/regex/pull/362):
77 Memory leaks caused by an internal caching strategy should now be fixed.
78 * [BUG #576](https://github.com/rust-lang/regex/pull/576):
79 All regex types now implement `UnwindSafe` and `RefUnwindSafe`.
80 * [BUG #728](https://github.com/rust-lang/regex/pull/749):
81 Add missing `Replacer` impls for `Vec<u8>`, `String`, `Cow`, etc.
86 This is a small patch release that adds some missing standard trait
87 implementations for some types in the public API.
91 * [BUG #734](https://github.com/rust-lang/regex/pull/734):
92 Add `FusedIterator` and `ExactSizeIterator` impls to iterator types.
93 * [BUG #735](https://github.com/rust-lang/regex/pull/735):
94 Add missing `Debug` impls to public API types.
99 This is a small bug fix release that bans `\P{any}`. We previously banned empty
100 classes like `[^\w\W]`, but missed the `\P{any}` case. In the future, we hope
101 to permit empty classes.
103 * [BUG #722](https://github.com/rust-lang/regex/issues/722):
104 Ban `\P{any}` to avoid a panic in the regex compiler. Found by OSS-Fuzz.
109 This is a small bug fix release that makes `\p{cf}` work. Previously, it would
110 report "property not found" even though `cf` is a valid abbreviation for the
111 `Format` general category.
113 * [BUG #719](https://github.com/rust-lang/regex/issues/719):
114 Fixes bug that prevented `\p{cf}` from working.
119 This releases has a few minor documentation fixes as well as some very minor
120 API additions. The MSRV remains at Rust 1.28 for now, but this is intended to
121 increase to at least Rust 1.41.1 soon.
123 This release also adds support for OSS-Fuzz. Kudos to
124 [@DavidKorczynski](https://github.com/DavidKorczynski)
125 for doing the heavy lifting for that!
129 * [FEATURE #649](https://github.com/rust-lang/regex/issues/649):
130 Support `[`, `]` and `.` in capture group names.
131 * [FEATURE #687](https://github.com/rust-lang/regex/issues/687):
132 Add `is_empty` predicate to `RegexSet`.
133 * [FEATURE #689](https://github.com/rust-lang/regex/issues/689):
134 Implement `Clone` for `SubCaptureMatches`.
135 * [FEATURE #715](https://github.com/rust-lang/regex/issues/715):
136 Add `empty` constructor to `RegexSet` for convenience.
140 * [BUG #694](https://github.com/rust-lang/regex/issues/694):
141 Fix doc example for `Replacer::replace_append`.
142 * [BUG #698](https://github.com/rust-lang/regex/issues/698):
143 Clarify docs for `s` flag when using a `bytes::Regex`.
144 * [BUG #711](https://github.com/rust-lang/regex/issues/711):
145 Clarify `is_match` docs to indicate that it can match anywhere in string.
150 This release fixes a MSRV (Minimum Support Rust Version) regression in the
151 1.3.8 release. Namely, while 1.3.8 compiles on Rust 1.28, it actually does not
152 compile on other Rust versions, such as Rust 1.39.
156 * [BUG #685](https://github.com/rust-lang/regex/issues/685):
157 Remove use of `doc_comment` crate, which cannot be used before Rust 1.43.
162 This release contains a couple of important bug fixes driven
163 by better support for empty-subexpressions in regexes. For
164 example, regexes like `b|` are now allowed. Major thanks to
165 [@sliquister](https://github.com/sliquister) for implementing support for this
166 in [#677](https://github.com/rust-lang/regex/pull/677).
170 * [BUG #523](https://github.com/rust-lang/regex/pull/523):
171 Add note to documentation that spaces can be escaped in `x` mode.
172 * [BUG #524](https://github.com/rust-lang/regex/issues/524):
173 Add support for empty sub-expressions, including empty alternations.
174 * [BUG #659](https://github.com/rust-lang/regex/issues/659):
175 Fix match bug caused by an empty sub-expression miscompilation.
180 This release contains a small bug fix that fixes how `regex` forwards crate
181 features to `regex-syntax`. In particular, this will reduce recompilations in
186 * [BUG #665](https://github.com/rust-lang/regex/pull/665):
187 Fix feature forwarding to `regex-syntax`.
192 This release contains a sizable (~30%) performance improvement when compiling
193 some kinds of large regular expressions.
195 Performance improvements:
197 * [PERF #657](https://github.com/rust-lang/regex/pull/657):
198 Improvement performance of compiling large regular expressions.
203 This release updates this crate to Unicode 13.
207 * [FEATURE #653](https://github.com/rust-lang/regex/pull/653):
208 Update `regex-syntax` to Unicode 13.
213 This is a small bug fix release that fixes a bug related to the scoping of
214 flags in a regex. Namely, before this fix, a regex like `((?i)a)b)` would
215 match `aB` despite the fact that `b` should not be matched case insensitively.
219 * [BUG #640](https://github.com/rust-lang/regex/issues/640):
220 Fix bug related to the scoping of flags in a regex.
225 This is a small maintenance release that upgrades the dependency on
226 `thread_local` from `0.3` to `1.0`. The minimum supported Rust version remains
232 This is a small maintenance release with some house cleaning and bug fixes.
236 * [FEATURE #631](https://github.com/rust-lang/regex/issues/631):
237 Add a `Match::range` method an a `From<Match> for Range` impl.
241 * [BUG #521](https://github.com/rust-lang/regex/issues/521):
242 Corrects `/-/.splitn("a", 2)` to return `["a"]` instead of `["a", ""]`.
243 * [BUG #594](https://github.com/rust-lang/regex/pull/594):
244 Improve error reporting when writing `\p\`.
245 * [BUG #627](https://github.com/rust-lang/regex/issues/627):
246 Corrects `/-/.split("a-")` to return `["a", ""]` instead of `["a"]`.
247 * [BUG #633](https://github.com/rust-lang/regex/pull/633):
248 Squash deprecation warnings for the `std::error::Error::description` method.
253 This is a maintenance release with no changes in order to try to work-around
254 a [docs.rs/Cargo issue](https://github.com/rust-lang/docs.rs/issues/400).
259 This release adds a plethora of new crate features that permit users of regex
260 to shrink its size considerably, in exchange for giving up either functionality
261 (such as Unicode support) or runtime performance. When all such features are
262 disabled, the dependency tree for `regex` shrinks to exactly 1 crate
263 (`regex-syntax`). More information about the new crate features can be
264 [found in the docs](https://docs.rs/regex/*/#crate-features).
266 Note that while this is a new minor version release, the minimum supported
267 Rust version for this crate remains at `1.28.0`.
271 * [FEATURE #474](https://github.com/rust-lang/regex/issues/474):
272 The `use_std` feature has been deprecated in favor of the `std` feature.
273 The `use_std` feature will be removed in regex 2. Until then, `use_std` will
274 remain as an alias for the `std` feature.
275 * [FEATURE #583](https://github.com/rust-lang/regex/issues/583):
276 Add a substantial number of crate features shrinking `regex`.
281 This release does a bit of house cleaning. Namely:
283 * This repository is now using rustfmt.
284 * License headers have been removed from all files, in following suit with the
286 * Teddy has been removed from the `regex` crate, and is now part of the
287 `aho-corasick` crate.
288 [See `aho-corasick`'s new `packed` sub-module for details](https://docs.rs/aho-corasick/0.7.6/aho_corasick/packed/index.html).
289 * The `utf8-ranges` crate has been deprecated, with its functionality moving
291 [`utf8` sub-module of `regex-syntax`](https://docs.rs/regex-syntax/0.6.11/regex_syntax/utf8/index.html).
292 * The `ucd-util` dependency has been dropped, in favor of implementing what
293 little we need inside of `regex-syntax` itself.
295 In general, this is part of an ongoing (long term) effort to make optimizations
296 in the regex engine easier to reason about. The current code is too convoluted
297 and thus it is very easy to introduce new bugs. This simplification effort is
298 the primary motivation behind re-working the `aho-corasick` crate to not only
299 bundle algorithms like Teddy, but to also provide regex-like match semantics
302 Moving forward, the plan is to join up with the `bstr` and `regex-automata`
303 crates, with the former providing more sophisticated substring search
304 algorithms (thereby deleting existing code in `regex`) and the latter providing
305 ahead-of-time compiled DFAs for cases where they are inexpensive to compute.
310 This release updates regex's minimum supported Rust version to 1.28, which was
311 release almost 1 year ago. This release also updates regex's Unicode data
317 This release contains a bug fix that caused regex's tests to fail, due to a
318 dependency on an unreleased behavior in regex-syntax.
320 * [BUG #593](https://github.com/rust-lang/regex/issues/593):
321 Move an integration-style test on error messages into regex-syntax.
326 This release contains a few small internal refactorings. One of which fixes
327 an instance of undefined behavior in a part of the SIMD code.
331 * [BUG #545](https://github.com/rust-lang/regex/issues/545):
332 Improves error messages when a repetition operator is used without a number.
333 * [BUG #588](https://github.com/rust-lang/regex/issues/588):
334 Removes use of a repr(Rust) union used for type punning in the Teddy matcher.
335 * [BUG #591](https://github.com/rust-lang/regex/issues/591):
336 Update docs for running benchmarks and improve failure modes.
341 This release fixes up a few warnings as a result of recent deprecations.
346 This release fixes a regression introduced by a bug fix (for
347 [BUG #557](https://github.com/rust-lang/regex/issues/557)) which could cause
348 the regex engine to enter an infinite loop. This bug was originally
349 [reported against ripgrep](https://github.com/BurntSushi/ripgrep/issues/1247).
354 This release fixes a bug in regex's dependency specification where it requires
355 a newer version of regex-syntax, but this wasn't communicated correctly in the
356 Cargo.toml. This would have been caught by a minimal version check, but this
357 check was disabled because the `rand` crate itself advertises incorrect
358 dependency specifications.
362 * [BUG #570](https://github.com/rust-lang/regex/pull/570):
363 Fix regex-syntax minimal version.
368 This release fixes a backwards compatibility regression where Regex was no
369 longer UnwindSafe. This was caused by the upgrade to aho-corasick 0.7, whose
370 AhoCorasick type was itself not UnwindSafe. This has been fixed in aho-corasick
371 0.7.4, which we now require.
375 * [BUG #568](https://github.com/rust-lang/regex/pull/568):
376 Fix an API regression where Regex was no longer UnwindSafe.
381 This releases fixes a few bugs and adds a performance improvement when a regex
382 is a simple alternation of literals.
384 Performance improvements:
386 * [OPT #566](https://github.com/rust-lang/regex/pull/566):
387 Upgrades `aho-corasick` to 0.7 and uses it for `foo|bar|...|quux` regexes.
391 * [BUG #527](https://github.com/rust-lang/regex/issues/527):
392 Fix a bug where the parser would panic on patterns like `((?x))`.
393 * [BUG #555](https://github.com/rust-lang/regex/issues/555):
394 Fix a bug where the parser would panic on patterns like `(?m){1,1}`.
395 * [BUG #557](https://github.com/rust-lang/regex/issues/557):
396 Fix a bug where captures could lead to an incorrect match.
401 This release fixes a bug found in the fix introduced in 1.1.1.
405 * [BUG edf45e6f](https://github.com/rust-lang/regex/commit/edf45e6f):
406 Fix bug introduced in reverse suffix literal matcher in the 1.1.1 release.
411 This is a small release with one fix for a bug caused by literal optimizations.
415 * [BUG 661bf53d](https://github.com/rust-lang/regex/commit/661bf53d):
416 Fixes a bug in the reverse suffix literal optimization. This was originally
418 [against ripgrep](https://github.com/BurntSushi/ripgrep/issues/1203).
423 This is a small release with a couple small enhancements. This release also
424 increases the minimal supported Rust version (MSRV) to 1.24.1 (from 1.20.0). In
425 accordance with this crate's MSRV policy, this release bumps the minor version
428 Performance improvements:
430 * [OPT #511](https://github.com/rust-lang/regex/pull/511),
431 [OPT #540](https://github.com/rust-lang/regex/pull/540):
432 Improve lazy DFA construction for large regex sets.
436 * [FEATURE #538](https://github.com/rust-lang/regex/pull/538):
437 Add Emoji and "break" Unicode properties. See [UNICODE.md](UNICODE.md).
441 * [BUG #530](https://github.com/rust-lang/regex/pull/530):
442 Add Unicode license (for data tables).
443 * Various typo/doc fixups.
448 This is a small release.
450 Performance improvements:
452 * [OPT #513](https://github.com/rust-lang/regex/pull/513):
453 Improve performance of compiling large Unicode classes by 8-10%.
457 * [BUG #533](https://github.com/rust-lang/regex/issues/533):
458 Fix definition of `[[:blank:]]` class that regressed in `regex-syntax 0.5`.
463 This is a small release with an API enhancement.
467 * [FEATURE #509](https://github.com/rust-lang/regex/pull/509):
468 Generalize impls of the `Replacer` trait.
473 This is a small release that bumps the quickcheck dependency.
478 This is a small bug fix release.
482 * [BUG #504](https://github.com/rust-lang/regex/pull/504):
483 Fix for Cargo's "minimal version" support.
484 * [BUG 1e39165f](https://github.com/rust-lang/regex/commit/1e39165f):
485 Fix doc examples for byte regexes.
490 This release exposes some new lower level APIs on `Regex` that permit
491 amortizing allocation and controlling the location at which a search is
492 performed in a more granular way. Most users of the regex crate will not
493 need or want to use these APIs.
497 * [FEATURE #493](https://github.com/rust-lang/regex/pull/493):
498 Add a few lower level APIs for amortizing allocation and more fine grained
503 * [BUG 3981d2ad](https://github.com/rust-lang/regex/commit/3981d2ad):
504 Correct outdated documentation on `RegexBuilder::dot_matches_new_line`.
505 * [BUG 7ebe4ae0](https://github.com/rust-lang/regex/commit/7ebe4ae0):
506 Correct outdated documentation on `Parser::allow_invalid_utf8` in the
507 `regex-syntax` crate.
508 * [BUG 24c7770b](https://github.com/rust-lang/regex/commit/24c7770b):
509 Fix a bug in the HIR printer where it wouldn't correctly escape meta
510 characters in character classes.
515 This release upgrades regex's Unicode tables to Unicode 11, and enables SIMD
516 optimizations automatically on Rust stable (1.27 or newer).
520 * [FEATURE #486](https://github.com/rust-lang/regex/pull/486):
521 Implement `size_hint` on `RegexSet` match iterators.
522 * [FEATURE #488](https://github.com/rust-lang/regex/pull/488):
523 Update Unicode tables for Unicode 11.
524 * [FEATURE #490](https://github.com/rust-lang/regex/pull/490):
525 SIMD optimizations are now enabled automatically in Rust stable, for versions
526 1.27 and up. No compilation flags or features need to be set. CPU support
527 SIMD is detected automatically at runtime.
531 * [BUG #482](https://github.com/rust-lang/regex/pull/482):
532 Present a better compilation error when the `use_std` feature isn't used.
537 This release marks the 1.0 release of regex.
539 While this release includes some breaking changes, most users of older versions
540 of the regex library should be able to migrate to 1.0 by simply bumping the
541 version number. The important changes are as follows:
543 * We adopt Rust 1.20 as the new minimum supported version of Rust for regex.
544 We also tentativley adopt a policy that permits bumping the minimum supported
545 version of Rust in minor version releases of regex, but no patch releases.
546 That is, with respect to semver, we do not strictly consider bumping the
547 minimum version of Rust to be a breaking change, but adopt a conservative
548 stance as a compromise.
549 * Octal syntax in regular expressions has been disabled by default. This
550 permits better error messages that inform users that backreferences aren't
551 available. Octal syntax can be re-enabled via the corresponding option on
553 * `(?-u:\B)` is no longer allowed in Unicode regexes since it can match at
554 invalid UTF-8 code unit boundaries. `(?-u:\b)` is still allowed in Unicode
556 * The `From<regex_syntax::Error>` impl has been removed. This formally removes
557 the public dependency on `regex-syntax`.
558 * A new feature, `use_std`, has been added and enabled by default. Disabling
559 the feature will result in a compilation error. In the future, this may
560 permit us to support `no_std` environments (w/ `alloc`) in a backwards
563 For more information and discussion, please see
564 [1.0 release tracking issue](https://github.com/rust-lang/regex/issues/457).
569 This release primarily contains bug fixes. Some of them resolve bugs where
570 the parser could panic.
574 * [FEATURE #459](https://github.com/rust-lang/regex/pull/459):
575 Include C++'s standard regex library and Boost's regex library in the
576 benchmark harness. We now include D/libphobos, C++/std, C++/boost, Oniguruma,
577 PCRE1, PCRE2, RE2 and Tcl in the harness.
581 * [BUG #445](https://github.com/rust-lang/regex/issues/445):
582 Clarify order of indices returned by RegexSet match iterator.
583 * [BUG #461](https://github.com/rust-lang/regex/issues/461):
584 Improve error messages for invalid regexes like `[\d-a]`.
585 * [BUG #464](https://github.com/rust-lang/regex/issues/464):
586 Fix a bug in the error message pretty printer that could cause a panic when
587 a regex contained a literal `\n` character.
588 * [BUG #465](https://github.com/rust-lang/regex/issues/465):
589 Fix a panic in the parser that was caused by applying a repetition operator
591 * [BUG #466](https://github.com/rust-lang/regex/issues/466):
592 Fix a bug where `\pC` was not recognized as an alias for `\p{Other}`.
593 * [BUG #470](https://github.com/rust-lang/regex/pull/470):
594 Fix a bug where literal searches did more work than necessary for anchored
600 This release primarily updates the regex crate to changes made in `std::arch`
605 * [FEATURE #458](https://github.com/rust-lang/regex/pull/458):
606 The `Hir` type in `regex-syntax` now has a printer.
611 This release introduces a new nightly only feature, `unstable`, which enables
612 SIMD optimizations for certain types of regexes. No additional compile time
613 options are necessary, and the regex crate will automatically choose the
614 best CPU features at run time. As a result, the `simd` (nightly only) crate
615 dependency has been dropped.
619 * [FEATURE #456](https://github.com/rust-lang/regex/pull/456):
620 The regex crate now includes AVX2 optimizations in addition to the extant
625 * [BUG #455](https://github.com/rust-lang/regex/pull/455):
626 Fix a bug where `(?x)[ / - ]` failed to parse.
633 * [BUG #454](https://github.com/rust-lang/regex/pull/454):
634 Fix a bug in the nest limit checker being too aggressive.
639 This release includes a ground-up rewrite of the regex-syntax crate, which has
640 been in development for over a year.
644 * Error messages for invalid regexes have been greatly improved. You get these
645 automatically; you don't need to do anything. In addition to better
646 formatting, error messages will now explicitly call out the use of look
647 around. When regex 1.0 is released, this will happen for backreferences as
649 * Full support for intersection, difference and symmetric difference of
650 character classes. These can be used via the `&&`, `--` and `~~` binary
651 operators within classes.
652 * A Unicode Level 1 conformat implementation of `\p{..}` character classes.
653 Things like `\p{scx:Hira}`, `\p{age:3.2}` or `\p{Changes_When_Casefolded}`
654 now work. All property name and value aliases are supported, and properties
655 are selected via loose matching. e.g., `\p{Greek}` is the same as
657 * A new `UNICODE.md` document has been added to this repository that
658 exhaustively documents support for UTS#18.
659 * Empty sub-expressions are now permitted in most places. That is, `()+` is
661 * Almost everything in regex-syntax now uses constant stack space, even when
662 performing anaylsis that requires structural induction. This reduces the risk
663 of a user provided regular expression causing a stack overflow.
664 * [FEATURE #174](https://github.com/rust-lang/regex/issues/174):
665 The `Ast` type in `regex-syntax` now contains span information.
666 * [FEATURE #424](https://github.com/rust-lang/regex/issues/424):
667 Support `\u`, `\u{...}`, `\U` and `\U{...}` syntax for specifying code points
668 in a regular expression.
669 * [FEATURE #449](https://github.com/rust-lang/regex/pull/449):
670 Add a `Replace::by_ref` adapter for use of a replacer without consuming it.
674 * [BUG #446](https://github.com/rust-lang/regex/issues/446):
675 We re-enable the Boyer-Moore literal matcher.
682 * [BUG #446](https://github.com/rust-lang/regex/issues/446):
683 Fixes a bug in the new Boyer-Moore searcher that results in a match failure.
684 We fix this bug by temporarily disabling Boyer-Moore.
691 * [BUG #437](https://github.com/rust-lang/regex/issues/437):
692 Fixes a bug in the new Boyer-Moore searcher that results in a panic.
699 * [FEATURE #348](https://github.com/rust-lang/regex/pull/348):
700 Improve performance for capture searches on anchored regex.
701 (Contributed by @ethanpailes. Nice work!)
702 * [FEATURE #419](https://github.com/rust-lang/regex/pull/419):
703 Expand literal searching to include Tuned Boyer-Moore in some cases.
704 (Contributed by @ethanpailes. Nice work!)
708 * [BUG](https://github.com/rust-lang/regex/pull/436):
709 The regex compiler plugin has been removed.
710 * [BUG](https://github.com/rust-lang/regex/pull/436):
711 `simd` has been bumped to `0.2.1`, which fixes a Rust nightly build error.
712 * [BUG](https://github.com/rust-lang/regex/pull/436):
713 Bring the benchmark harness up to date.
720 * [FEATURE #374](https://github.com/rust-lang/regex/pull/374):
721 Add `impl From<Match> for &str`.
722 * [FEATURE #380](https://github.com/rust-lang/regex/pull/380):
723 Derive `Clone` and `PartialEq` on `Error`.
724 * [FEATURE #400](https://github.com/rust-lang/regex/pull/400):
725 Update to Unicode 10.
729 * [BUG #375](https://github.com/rust-lang/regex/issues/375):
730 Fix a bug that prevented the bounded backtracker from terminating.
731 * [BUG #393](https://github.com/rust-lang/regex/issues/393),
732 [BUG #394](https://github.com/rust-lang/regex/issues/394):
733 Fix bug with `replace` methods for empty matches.
740 * [FEATURE #341](https://github.com/rust-lang/regex/issues/341):
741 Support nested character classes and intersection operation.
742 For example, `[\p{Greek}&&\pL]` matches greek letters and
743 `[[0-9]&&[^4]]` matches every decimal digit except `4`.
744 (Much thanks to @robinst, who contributed this awesome feature.)
748 * [BUG #321](https://github.com/rust-lang/regex/issues/321):
749 Fix bug in literal extraction and UTF-8 decoding.
750 * [BUG #326](https://github.com/rust-lang/regex/issues/326):
751 Add documentation tip about the `(?x)` flag.
752 * [BUG #333](https://github.com/rust-lang/regex/issues/333):
753 Show additional replacement example using curly braces.
754 * [BUG #334](https://github.com/rust-lang/regex/issues/334):
755 Fix bug when resolving captures after a match.
756 * [BUG #338](https://github.com/rust-lang/regex/issues/338):
757 Add example that uses `Captures::get` to API documentation.
758 * [BUG #353](https://github.com/rust-lang/regex/issues/353):
759 Fix RegexSet bug that caused match failure in some cases.
760 * [BUG #354](https://github.com/rust-lang/regex/pull/354):
761 Fix panic in parser when `(?x)` is used.
762 * [BUG #358](https://github.com/rust-lang/regex/issues/358):
763 Fix literal optimization bug with RegexSet.
764 * [BUG #359](https://github.com/rust-lang/regex/issues/359):
765 Fix example code in README.
766 * [BUG #365](https://github.com/rust-lang/regex/pull/365):
767 Fix bug in `rure_captures_len` in the C binding.
768 * [BUG #367](https://github.com/rust-lang/regex/issues/367):
769 Fix byte class bug that caused a panic.
774 One major bug with `replace_all` has been fixed along with a couple of other
777 * [BUG #312](https://github.com/rust-lang/regex/issues/312):
778 Fix documentation for `NoExpand` to reference correct lifetime parameter.
779 * [BUG #314](https://github.com/rust-lang/regex/issues/314):
780 Fix a bug with `replace_all` when replacing a match with the empty string.
781 * [BUG #316](https://github.com/rust-lang/regex/issues/316):
782 Note a missing breaking change from the `0.2.0` CHANGELOG entry.
783 (`RegexBuilder::compile` was renamed to `RegexBuilder::build`.)
784 * [BUG #324](https://github.com/rust-lang/regex/issues/324):
785 Compiling `regex` should only require one version of `memchr` crate.
790 This is a new major release of the regex crate, and is an implementation of the
791 [regex 1.0 RFC](https://github.com/rust-lang/rfcs/blob/master/text/1620-regex-1.0.md).
792 We are releasing a `0.2` first, and if there are no major problems, we will
793 release a `1.0` shortly. For `0.2`, the minimum *supported* Rust version is
796 There are a number of **breaking changes** in `0.2`. They are split into two
797 types. The first type correspond to breaking changes in regular expression
798 syntax. The second type correspond to breaking changes in the API.
800 Breaking changes for regex syntax:
802 * POSIX character classes now require double bracketing. Previously, the regex
803 `[:upper:]` would parse as the `upper` POSIX character class. Now it parses
804 as the character class containing the characters `:upper:`. The fix to this
805 change is to use `[[:upper:]]` instead. Note that variants like
806 `[[:upper:][:blank:]]` continue to work.
807 * The character `[` must always be escaped inside a character class.
808 * The characters `&`, `-` and `~` must be escaped if any one of them are
809 repeated consecutively. For example, `[&]`, `[\&]`, `[\&\&]`, `[&-&]` are all
810 equivalent while `[&&]` is illegal. (The motivation for this and the prior
811 change is to provide a backwards compatible path for adding character class
813 * A `bytes::Regex` now has Unicode mode enabled by default (like the main
814 `Regex` type). This means regexes compiled with `bytes::Regex::new` that
815 don't have the Unicode flag set should add `(?-u)` to recover the original
818 Breaking changes for the regex API:
820 * `find` and `find_iter` now **return `Match` values instead of
821 `(usize, usize)`.** `Match` values have `start` and `end` methods, which
822 return the match offsets. `Match` values also have an `as_str` method,
823 which returns the text of the match itself.
824 * The `Captures` type now only provides a single iterator over all capturing
825 matches, which should replace uses of `iter` and `iter_pos`. Uses of
826 `iter_named` should use the `capture_names` method on `Regex`.
827 * The `at` method on the `Captures` type has been renamed to `get`, and it
828 now returns a `Match`. Similarly, the `name` method on `Captures` now returns
830 * The `replace` methods now return `Cow` values. The `Cow::Borrowed` variant
831 is returned when no replacements are made.
832 * The `Replacer` trait has been completely overhauled. This should only
833 impact clients that implement this trait explicitly. Standard uses of
834 the `replace` methods should continue to work unchanged. If you implement
835 the `Replacer` trait, please consult the new documentation.
836 * The `quote` free function has been renamed to `escape`.
837 * The `Regex::with_size_limit` method has been removed. It is replaced by
838 `RegexBuilder::size_limit`.
839 * The `RegexBuilder` type has switched from owned `self` method receivers to
840 `&mut self` method receivers. Most uses will continue to work unchanged, but
841 some code may require naming an intermediate variable to hold the builder.
842 * The `compile` method on `RegexBuilder` has been renamed to `build`.
843 * The free `is_match` function has been removed. It is replaced by compiling
844 a `Regex` and calling its `is_match` method.
845 * The `PartialEq` and `Eq` impls on `Regex` have been dropped. If you relied
846 on these impls, the fix is to define a wrapper type around `Regex`, impl
847 `Deref` on it and provide the necessary impls.
848 * The `is_empty` method on `Captures` has been removed. This always returns
849 `false`, so its use is superfluous.
850 * The `Syntax` variant of the `Error` type now contains a string instead of
851 a `regex_syntax::Error`. If you were examining syntax errors more closely,
852 you'll need to explicitly use the `regex_syntax` crate to re-parse the regex.
853 * The `InvalidSet` variant of the `Error` type has been removed since it is
855 * Most of the iterator types have been renamed to match conventions. If you
856 were using these iterator types explicitly, please consult the documentation
857 for its new name. For example, `RegexSplits` has been renamed to `Split`.
859 A number of bugs have been fixed:
861 * [BUG #151](https://github.com/rust-lang/regex/issues/151):
862 The `Replacer` trait has been changed to permit the caller to control
864 * [BUG #165](https://github.com/rust-lang/regex/issues/165):
865 Remove the free `is_match` function.
866 * [BUG #166](https://github.com/rust-lang/regex/issues/166):
867 Expose more knobs (available in `0.1`) and remove `with_size_limit`.
868 * [BUG #168](https://github.com/rust-lang/regex/issues/168):
869 Iterators produced by `Captures` now have the correct lifetime parameters.
870 * [BUG #175](https://github.com/rust-lang/regex/issues/175):
871 Fix a corner case in the parsing of POSIX character classes.
872 * [BUG #178](https://github.com/rust-lang/regex/issues/178):
873 Drop the `PartialEq` and `Eq` impls on `Regex`.
874 * [BUG #179](https://github.com/rust-lang/regex/issues/179):
875 Remove `is_empty` from `Captures` since it always returns false.
876 * [BUG #276](https://github.com/rust-lang/regex/issues/276):
877 Position of named capture can now be retrieved from a `Captures`.
878 * [BUG #296](https://github.com/rust-lang/regex/issues/296):
879 Remove winapi/kernel32-sys dependency on UNIX.
880 * [BUG #307](https://github.com/rust-lang/regex/issues/307):
881 Fix error on emscripten.
886 * [PR #292](https://github.com/rust-lang/regex/pull/292):
887 Fixes bug #291, which was introduced by PR #290.
891 * Require regex-syntax 0.3.8.
895 * [PR #290](https://github.com/rust-lang/regex/pull/290):
896 Fixes bug #289, which caused some regexes with a certain combination
897 of literals to match incorrectly.
901 * [PR #281](https://github.com/rust-lang/regex/pull/281):
902 Fixes bug #280 by disabling all literal optimizations when a pattern
903 is partially anchored.
907 * Tweak criteria for using the Teddy literal matcher.
911 * [PR #275](https://github.com/rust-lang/regex/pull/275):
912 Improves match verification performance in the Teddy SIMD searcher.
913 * [PR #278](https://github.com/rust-lang/regex/pull/278):
914 Replaces slow substring loop in the Teddy SIMD searcher with Aho-Corasick.
915 * Implemented DoubleEndedIterator on regex set match iterators.
919 * Release regex-syntax 0.3.5 with a minor bug fix.
922 * [PR #270](https://github.com/rust-lang/regex/pull/270):
923 Fixes bugs #264, #268 and an unreported where the DFA cache size could be
924 drastically under estimated in some cases (leading to high unexpected memory
929 * Release `regex-syntax 0.3.4`.
930 * Bump `regex-syntax` dependency version for `regex` to `0.3.4`.
934 * [PR #262](https://github.com/rust-lang/regex/pull/262):
935 Fixes a number of small bugs caught by fuzz testing (AFL).
939 * [PR #236](https://github.com/rust-lang/regex/pull/236):
940 Fix a bug in how suffix literals were extracted, which could lead
941 to invalid match behavior in some cases.
945 * [PR #231](https://github.com/rust-lang/regex/pull/231):
946 Add SIMD accelerated multiple pattern search.
947 * [PR #228](https://github.com/rust-lang/regex/pull/228):
948 Reintroduce the reverse suffix literal optimization.
949 * [PR #226](https://github.com/rust-lang/regex/pull/226):
950 Implements NFA state compression in the lazy DFA.
951 * [PR #223](https://github.com/rust-lang/regex/pull/223):
952 A fully anchored RegexSet can now short-circuit.
956 * [PR #216](https://github.com/rust-lang/regex/pull/216):
957 Tweak the threshold for running backtracking.
958 * [PR #217](https://github.com/rust-lang/regex/pull/217):
959 Add upper limit (from the DFA) to capture search (for the NFA).
960 * [PR #218](https://github.com/rust-lang/regex/pull/218):
965 * [PR #210](https://github.com/rust-lang/regex/pull/210):
966 Fixed a performance bug in `bytes::Regex::replace` where `extend` was used
967 instead of `extend_from_slice`.
968 * [PR #211](https://github.com/rust-lang/regex/pull/211):
969 Fixed a bug in the handling of word boundaries in the DFA.
970 * [PR #213](https://github.com/rust-lang/pull/213):
971 Added RE2 and Tcl to the benchmark harness. Also added a CLI utility from
972 running regexes using any of the following regex engines: PCRE1, PCRE2,
973 Oniguruma, RE2, Tcl and of course Rust's own regexes.
977 * [PR #201](https://github.com/rust-lang/regex/pull/201):
978 Fix undefined behavior in the `regex!` compiler plugin macro.
979 * [PR #205](https://github.com/rust-lang/regex/pull/205):
980 More improvements to DFA performance. Competitive with RE2. See PR for
982 * [PR #209](https://github.com/rust-lang/regex/pull/209):
983 Release 0.1.66 was semver incompatible since it required a newer version
984 of Rust than previous releases. This PR fixes that. (And `0.1.66` was
989 * Speculative support for Unicode word boundaries was added to the DFA. This
990 should remove the last common case that disqualified use of the DFA.
991 * An optimization that scanned for suffix literals and then matched the regular
992 expression in reverse was removed because it had worst case quadratic time
993 complexity. It was replaced with a more limited optimization where, given any
994 regex of the form `re$`, it will be matched in reverse from the end of the
996 * [PR #202](https://github.com/rust-lang/regex/pull/202):
997 The inner loop of the DFA was heavily optimized to improve cache locality
998 and reduce the overall number of instructions run on each iteration. This
999 represents the first use of `unsafe` in `regex` (to elide bounds checks).
1000 * [PR #200](https://github.com/rust-lang/regex/pull/200):
1001 Use of the `mempool` crate (which used thread local storage) was replaced
1002 with a faster version of a similar API in @Amanieu's `thread_local` crate.
1003 It should reduce contention when using a regex from multiple threads
1005 * PCRE2 JIT benchmarks were added. A benchmark comparison can be found
1006 [here](https://gist.github.com/anonymous/14683c01993e91689f7206a18675901b).
1007 (Includes a comparison with PCRE1's JIT and Oniguruma.)
1008 * A bug where word boundaries weren't being matched correctly in the DFA was
1009 fixed. This only affected use of `bytes::Regex`.
1010 * [#160](https://github.com/rust-lang/regex/issues/160):
1011 `Captures` now has a `Debug` impl.