Regex Versions Save

An implementation of regular expressions for Rust. This implementation uses finite automata and guarantees linear time matching on all inputs.

1.0.0

5 years ago

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:

  • We adopt Rust 1.20 as the new minimum supported version of Rust for regex. We also tentativley adopt a policy that permits bumping the minimum supported version of Rust in minor version releases of regex, but no patch releases. That is, with respect to semver, we do not strictly consider bumping the minimum version of Rust to be a breaking change, but adopt a conservative stance as a compromise.
  • Octal syntax in regular expressions has been disabled by default. This permits better error messages that inform users that backreferences aren't available. Octal syntax can be re-enabled via the corresponding option on RegexBuilder.
  • (?-u:\B) is no longer allowed in Unicode regexes since it can match at invalid UTF-8 code unit boundaries. (?-u:\b) is still allowed in Unicode regexes.
  • The From<regex_syntax::Error> impl has been removed. This formally removes the public dependency on regex-syntax.
  • A new feature, use_std, has been added and enabled by default. Disabling the feature will result in a compilation error. In the future, this may permit us to support no_std environments (w/ alloc) in a backwards compatible way.

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

0.2.7

6 years ago

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

New features:

  • Error messages for invalid regexes have been greatly improved. You get these automatically; you don't need to do anything. In addition to better formatting, error messages will now explicitly call out the use of look around. When regex 1.0 is released, this will happen for backreferences as well.
  • Full support for intersection, difference and symmetric difference of character classes. These can be used via the &&, -- and ~~ binary operators within classes.
  • A Unicode Level 1 conformat implementation of \p{..} character classes. Things like \p{scx:Hira}, \p{age:3.2} or \p{Changes_When_Casefolded} now work. All property name and value aliases are supported, and properties are selected via loose matching. e.g., \p{Greek} is the same as \p{G r E e K}.
  • A new UNICODE.md document has been added to this repository that exhaustively documents support for UTS#18.
  • Empty sub-expressions are now permitted in most places. That is, ()+ is now a valid regex.
  • Almost everything in regex-syntax now uses constant stack space, even when performing anaylsis that requires structural induction. This reduces the risk of a user provided regular expression causing a stack overflow.
  • FEATURE #174: The Ast type in regex-syntax now contains span information.
  • FEATURE #424: Support \u, \u{...}, \U and \U{...} syntax for specifying code points in a regular expression.
  • FEATURE #449: Add a Replace::by_ref adapter for use of a replacer without consuming it.

Bug fixes:

  • BUG #446: We re-enable the Boyer-Moore literal matcher.

0.2.2

6 years ago

New features:

  • FEATURE #341: Support nested character classes and intersection operation. For example, [\p{Greek}&&\pL] matches greek letters and [[0-9]&&[^4]] matches every decimal digit except 4. (Much thanks to @robinst, who contributed this awesome feature.)

Bug fixes:

  • BUG #321: Fix bug in literal extraction and UTF-8 decoding.
  • BUG #326: Add documentation tip about the (?x) flag.
  • BUG #333: Show additional replacement example using curly braces.
  • BUG #334: Fix bug when resolving captures after a match.
  • BUG #338: Add example that uses Captures::get to API documentation.
  • BUG #353: Fix RegexSet bug that caused match failure in some cases.
  • BUG #354: Fix panic in parser when (?x) is used.
  • BUG #358: Fix literal optimization bug with RegexSet.
  • BUG #359: Fix example code in README.
  • BUG #365: Fix bug in rure_captures_len in the C binding.
  • BUG #367: Fix byte class bug that caused a panic.