Skip to content

Releases: slevithan/regex

v4.2.1

05 Sep 00:44
Compare
Choose a tag to compare

🚀 Features

  • Renamed function processRegex as rewrite.
    • processRegex remains as a deprecated alias but will be removed in the next release.

v4.2.0

04 Sep 19:31
Compare
Choose a tag to compare

🚀 Features

  • Added function processRegex, which returns an object with expression and flags strings.
    • Warning: This feature is experimental and may change without following semver.

🐞 Fixes

  • When using emulated flag x, if flag v is disabled or unsupported and unicodeSetsPlugin is explicitly set to null, allow whitespace-separated, unescaped (literal) hyphens on the end of character class ranges.

v4.1.3

24 Aug 16:46
Compare
Choose a tag to compare

🚀 Features

  • Added a top-level types field to package.json for tools and configurations that rely on it. (#23, @jaslong)
  • Avoids auto-escaping certain characters within character classes when not required. (#22)

v4.1.2

22 Aug 13:13
Compare
Choose a tag to compare

🚀 Features

v4.1.1

18 Aug 13:46
Compare
Choose a tag to compare

🚀 Features

  • Combining atomic/possessive syntax with subroutines previously resulted in subroutines using capturing wrappers. This is now avoided when the regex doesn’t use backreferences, resulting in faster-running generated regex source.
  • Possessive fixed repetition quantifiers (e.g. {2}+) are now converted to greedy quantifiers (e.g. {2}), which gives the same behavior with faster-running generated regex source.

🐞 Fixes

  • When using extended syntax (e.g. atomic groups) that resulted in the use of emulation groups in generated source, the subclass: true option could lead to incorrect values for submatches that preceded emulation groups, when used outside of the regex.

v4.1.0

16 Aug 09:43
Compare
Choose a tag to compare

🚀 Features

  • Added support for possessive quantifiers.

v4.0.0

06 Aug 17:08
Compare
Choose a tag to compare

This release focused on improving and simplifying the API for advanced options and plugins. With the new features, all JavaScript-based tools that provide regex search or replace can now benefit from adopting regex.

🚨 Breaking

  • The previously experimental/debugging options __flagX, __flagN, __flagV, and __extendSyntax have been redesigned and renamed, and are now documented features via the new options disable: {x, n, v, atomic, subroutines} and force: {v}. The __rake option has been removed, and its behavior is now applied whenever flag x is enabled.
  • The ability to provide an alternate RegExp constructor by modifying this has been removed.
  • Renamed option postprocessors as plugins.
  • Plugins now receive flags as a property of their second argument.

🚀 Features

  • New option subclass: true results in numbered backreferences used outside of the regex automatically referencing their correct groups, in all contexts. The underlying issue is that emulating extended syntax (atomic groups and subroutines) sometimes requires adding anonymous "emulation group" captures to generated regex source. This was already mostly a non-issue because implicit flag n requires the use of named groups. This new option makes it safe to disable n and rely on group numbers while using extended syntax.
  • New option unicodeSetsPlugin allows overriding or removing the built-in backward compatibility for environments without native support for flag v.
  • When using atomic groups, numbered backreferences within the regex (from interpolated regexes, or when flag n is disabled) are now supported and automatically adjusted (previously threw a descriptive error).
  • Improved TypeScript types and introduced type tests, with extensive help and advice from @benblank.
  • The flags provided to plugins now include the implicit v or u (whichever will be used, based on provided options and the environment's native support for v).
  • The built-in backcompat layer no longer throws in the edge case of using doubly-negated [^\P{…}] with flag i in environments that don't natively support flag v, since the handling was incomplete and the syntax is not always problematic. New option unicodeSetsPlugin allows providing a more robust v transpiler, if needed.

🐞 Fixes

  • Fixed backreference adjustments when atomic groups contain capturing groups.

v3.1.0

26 Jul 18:38
Compare
Choose a tag to compare

🚀 Features

  • Added a browser-compatible ESM bundle, and updated exports to use it.
  • Added debugging option __extendSyntax, which defaults to the value of __flagN.
  • Subroutines avoid adding anonymous captures for regexes that don't use backreferences.
  • The token separator (?:) is added to emitted regex source in fewer cases.

🐞 Fixes

  • Rewrote subroutine backreference handling for maintainability, and fixed some complex edge cases in the process.
  • Avoids removing (?:) in edge cases when doing so would make an invalid regex valid.

v3.0.0

21 Jul 22:43
Compare
Choose a tag to compare

🚨 Breaking

  • Renamed function/tag partial as pattern.

🚀 Features

  • Added support for subroutine definition groups via (?(DEFINE)…) at the end of a regex.
  • Added TypeScript declarations, and improved JSDoc-based types. (#6, @rauschma)
  • Testing improvements to make tests pass with Node.js 14+.

🐞 Fixes

  • Fixed an issue with interpolating a regex with numbered backreferences into a pattern with lookbehind, which could throw in edge cases.
  • Fixed an issue that could allow subroutines to reference lookbehind in edge cases.
  • Fixed edge case issues with subroutines that referenced groups containing backreferences to themselves.

v2.1.0

26 Jun 15:47
Compare
Choose a tag to compare

🚀 Features

  • Now works in environments without native flag v support, extending compatibility from Node.js 20 to 14, and from 2023-era to 2020-era browsers (2017-era browsers with a transpilation build step).
  • Postprocessors now receive the flags in use as an argument.