js-regexp
Ergonomic Rust bindings to the JavaScript standard built-in RegExp
object
In WASM environments that are attached to a JavaScript runtime, depending on a crate like regex
for regular expression matching can seem silly (at least when package size is a concern) - There's a perfectly fine
regular expression engine right there, in JavaScript! And while js-sys
does
expose the standard built-in RegExp
object, it does not aim to provide a convenient interface.
This crate aims to bridge that gap.
Usage
See the rustdoc documentation for detailed usage information.
Basic example
use
let re = new
.unwrap;
let result = re.exec.unwrap;
let named_captures = result.captures.unwrap;
let named_captures = named_captures.get_named_captures_map;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;