NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io · #484 most downloaded on crates.io
An implementation of regexes, supporting a relatively rich set of features, including backreferences and look-around. Aims to be compatible with Oniguruma syntax when the relevant flag is set.
Last release 25 days ago
13 Sep 2026
Release timing varies
gaps range from 4 weeks to 10 months
Nearly every release is documented
notes for 30 of 30 stable releases
Nothing withdrawn
no release was ever pulled
10 years old
30 releases · first in 2017
Add a leftmost_longest feature (off by default) that adds a method to the RegexBuilder / RegexOptionsBuilder for building a VM which would operate in
leftmost_longest feature (off by default) that adds a method to the RegexBuilder/RegexOptionsBuilder for building a VM which would operate in leftmost-longest match mode instead of the regular leftmost-first mode. Useful for POSIX compliance. (#281)leftmost_longest feature (off by default) that adds a method to the RegexBuilder/RegexOptionsBuilder for building a VM which would operate in leftmost-longest match mode instead of the regular leftmost-first mode. Useful for POSIX compliance. (#281)capture_names() for a pattern with a zero-repeated named group such as (?<n>a){0} (#275)One column per quarter.
Add a perf-dfa-full feature (off by default, mirroring the regex crate) that lets regex-automata eagerly build fully compiled dense DFAs for small pat
perf-dfa-full feature (off by default, mirroring the regex crate) that lets regex-automata eagerly build fully compiled dense DFAs for small patterns, for workloads that compile few regexes and match them very heavily (#272)regex-automata dependency no longer enables the dfa-build feature by default. With dfa-build enabled, meta::Regex eagerly determinizes a full dense DFA for every small pattern, which dominated build time of simple class-containing patterns (e.g. \b(extern)\s+(crate) compiled ~4x slower than with the regex crate, which also ships without dfa-build); searches use the lazy DFA instead, with no measurable match-time difference (#272)optimize_nested_repeats pass could rewrite an optional capture group like (\w+)? into (\w*), causing an unmatched optional group to be reported as an empty match (Some("")) instead of None (#276)Matches , CaptureMatches , Captures , and SubCaptureMatches are now generic over RegexInput , which is a breaking change for code that named these typ…
BytesMode and the RegexInput trait so the matching and capture APIs can operate on strings or bytes, and allows to opt out of unicode handling if desired (#248)
RegexBuilder::disallow_empty_match_at_eof_after_newline to reject empty matches at the end of the haystack following a trailing newline, to match Oniguruma behavior (#247)RegexSet API for efficiently matching multiple patterns against the same text (#255)(?i)(\w+)\1 orders of magnitude faster on non-ASCII haystacks. The comparison is now strict fold equality over the captured text's byte-length window: a case-folded prefix of the window no longer counts as a match (previously a substring search could accept one and misalign the match end)Hir instead of a re-serialized pattern string, and RegexSet parses each pattern once for both of its set-wide engines instead of three times. This reduces compile time and peak compile memory, especially for RegexSet and small easy patternsis_match/find/find_iter and RegexSet candidate verification allocation-free per call; RegexSet::find_input no longer allocates at failed candidate positions. Short and repeated matches improve substantially (up to ~30% for small patterns, ~10% for find_iter over many matches); single very long backtracking runs, where per-run setup is fully amortized anyway, can be a few percent slowerMatches, CaptureMatches, Captures, and SubCaptureMatches are now generic over RegexInput, which is a breaking change for code that named these types explicitly (#248)(?u) / (?-u) flags are accepted when they agree with the builder configuration\G optimizations were applying where they shouldn't, giving wrong results (#256)+ only causes possessiveness after ?, * or + (#258)If you previously stored i.e. Captures, you would need to change the type to Captures<str> to get the code to compile.
Add support for \N to mean any character except newline, for Oniguruma compatibility
\N to mean any character except newline, for Oniguruma compatibility (#206)(*FAIL) backtracking control verb (#210)\p{...} and \P{...} aliases, for Oniguruma compatibility (#207)\R to mean general newline, matching all common line break characters, treating \r\n atomically (#220)(?R) CRLF mode flag (#238)\g<1> (#230)(?~abc) (#233)RegexBuilder can now build multiple patterns with the same options (#213)] (#211)Add support for "easy" variable-length lookbehinds (enabled via new feature flag) ( #194 , #196 )
\b{start}, \b{end}, \b{start-half}, \b{end-half} (#193){...} repetition syntax after assertions (except in Oniguruma mode) (#193)CompileError in Error enum to reduce size (#204)\G fails to match for increased performance (#198)ignore_whitespace case in parsing escape sequences (#193)Regex is Send and Sync (#195)Add an "oniguruma mode" flag to control whether \< and \> are treated as literals or word-boundary assertions.
\< and \> are treated as literals or word-boundary assertions. (#186)as_str is called. (#185)toy example wasn't always showing the correct analysis or compiled program when optimizations were applied. (#181)Fixed a bug whereby sometimes a backreference to a non-existing capture group would compile successfully when it should fail, causing a panic in the V
Add an optimization step after the pattern is parsed but before it is analyzed. Currently it only optimizes one specific use-case - where the expressi
^ when not in multiline mode) should now fail faster when there is no match, because fancy-regex no longer tries to match at other positions. (#170)CompileError for an invalid (numbered) backref has been updated to mention which backref was invalid (#170)Support \Z - anchor to the end of the text before any trailing newlines.
\Z - anchor to the end of the text before any trailing newlines. (#148)\O - any character including newlines. (#158)RegexBuilder: Add options for multi_line, ignore_whitespace, dot_matches_new_line (#165)Add split , splitn methods to Regex to split a string into substrings
Support for relative backreferences using \k<-1> (-1 references the previous group)
\k<-1> (-1 references thetry_replacen to Regex which returns a Result instead of panickingBacktrackLimitExceeded withRegexBuilder::backtrack_limit to help with that.[\A] used to error[A] (for compatibility with Oniguruma)(?( (#125)Support for no_std (the std feature is enabled by default but can be disabled if desired)
Support for conditionals: using a regex like (? a)?b(?(test)c|d) will try to match c after b if a matched in the capture group named test, otherwise d
(?<test>a)?b(?(test)c|d) will try to match c after b if a matched in the capture group named
test, otherwise d after b if a wasn't captured into the test group.Support for \G (anchor to end of previous match): Using a regex like \G\w will match each letter of foo in foo bar but nothing else.
\G (anchor to end of previous match): Using a regex
like \G\w will match each letter of foo in foo bar but
nothing else.Support for \K (keep out): Using a regex like @\K\w+ will match things like @foo but the resulting match text will only include foo, keeping out the @
\K (keep out): Using a regex like @\K\w+ will match
things like @foo but the resulting match text will only include
foo, keeping out the @.Allow users to disable any of the unicode and perf-* features of the regex crate. Disabling these features can reduce compile time and/or binary size
unicode and perf-* features of
the regex crate. Disabling these features can reduce compile time
and/or binary size for use cases where these features are not needed.
(All features remain enabled by default.)Fix panic on incomplete escape sequences in input regexes
+ in (?=hello)+Regex now has replace methods like the regex crate:
Regex now has replace methods like the regex crate:
replace - single replacementreplace_all - replace all non-overlapping matchesreplacen - configurable number of replacementsRegex now implements Clone, Display, FromStr
Regex now implements Clone, Display, FromStrCaptures now implements Index<usize> to access captures by number
and Index<&str> to access by nameMethods find_iter and captures_iter to iterate over all non-overlapping matches for a string
find_iter and captures_iter to iterate over all
non-overlapping matches for a stringfind_from_pos to find starting from a specific positionescape function to escape special characters in a string so that it matches literally
escape function to escape special characters in a string so that it
matches literallySupport for named groups and backrefs:
(?<name>...) or (?P<name>...)\k<name> or (?P=name)Captures::name to get matched group by nameRegex::capture_names to get capture names in regexCaptures::expand for regex crate compatible syntaxExpander for python-compatible syntax and advanced usageMatch::range and some From impls for convenienceInclude string snippet in errors for unknown group and invalid escape to make it easier to identify the problem.
Support comments using (?# comment) syntax
(?# comment) syntax\u21D2 and \U0001F60AOptimization: Delegate const-sized suffixes in more cases
captures_read_at when delegating to regex crateSome regexes with fancy parts in the beginning/middle didn't match when they should have, e.g. ((?!x)(a|ab))c didn't match abc.
((?!x)(a|ab))c didn't match abc.Add delegate_size_limit and delegate_dfa_size_limit to RegexBuilder to allow configuring these limits for regex crate.
delegate_size_limit and delegate_dfa_size_limit to
RegexBuilder to allow configuring these limits for regex crate.Add limit for backtracking so that execution errors instead of running for a long time in case of catastrophic backtracking.
RegexBuilder with backtrack_limit to configure the new
backtrack limit per regex.Error now implements std::error::Error traitChange find to return a Match struct (breaking change)
(?>foo) group syntax and the
a++, a*+ and a?+ possessive syntax\b, \f, \t, \n, \r, \vDebug for Regexfind to return a Match struct (breaking change)Captures API (breaking change):
at and pos with get that returns a Match structis_empty (use len)] and } as literals{ as literal when not after atom\< or \e inside character classes\x{...} escape(a|)] in character classes[Unreleased]: https://github.com/fancy-regex/fancy-regex/compare/0.19.2...HEAD [0.19.1]: https://github.com/fancy-regex/fancy-regex/compare/0.19.1...0
Your coding agent can read these notes before it upgrades. Set up the MCP server →