re2 0.2.0 copy "re2: ^0.2.0" to clipboard
re2: ^0.2.0 copied to clipboard

Linear-time regular expressions for Dart via Google's RE2 over FFI. Immune to catastrophic backtracking (ReDoS).

0.2.0 #

  • Add replaceAll and replaceFirst, the linear-time counterparts to String.replaceAll(RegExp(...), ...). Because RE2 cannot backtrack, running a substitution over untrusted input or with a user-supplied pattern cannot hang the isolate. The rewrite string can reference capture groups with \1..\9.

0.1.0 #

Initial release, vendoring RE2 (last revision before the Abseil dependency).

  • Re2: compile a pattern once, then hasMatch, firstMatch, stringMatch, and allMatches, with caseSensitive, multiLine, and dotAll flags.
  • Re2Match: positional and named group access.
  • Linear-time matching: catastrophic-backtracking patterns that hang dart:core RegExp stay linear here.
  • Backreferences and lookaround throw FormatException at construction, since RE2 does not support them.
  • Native code builds automatically via Dart build hooks (Dart 3.10+).
0
likes
0
points
364
downloads

Publisher

verified publisherdeveloperyusuf.com

Weekly Downloads

Linear-time regular expressions for Dart via Google's RE2 over FFI. Immune to catastrophic backtracking (ReDoS).

Repository (GitHub)
View/report issues

Topics

#regex #re2 #security #ffi #performance

License

unknown (license)

Dependencies

code_assets, ffi, hooks, native_toolchain_c

More

Packages that depend on re2