Expand description
resharp - regex engine with intersection, complement, and lookarounds, powered by symbolic derivatives and lazy DFA construction.
§quick start
let re = resharp::Regex::new(r"\d{3}-\d{4}").unwrap();
let matches = re.find_all(b"call 555-1234 or 555-5678").unwrap();
assert_eq!(matches.len(), 2);§options
use EngineOptions with Regex::with_options for non-default settings:
use resharp::{Regex, EngineOptions};
let re = Regex::with_options(
r"hello world",
EngineOptions::default()
.case_insensitive(true)
.dot_matches_new_line(true),
).unwrap();
assert!(re.is_match(b"Hello World").unwrap());§escaping user input
use escape to safely embed literal strings in patterns:
let user_input = "file (1).txt";
let pattern = format!(r"^{}$", resharp::escape(user_input));
let re = resharp::Regex::new(&pattern).unwrap();
assert!(re.is_match(b"file (1).txt").unwrap());Structs§
- Engine
Options - Engine configuration, passed to
Regex::with_options. - Match
- byte-offset range
[start, end). - NodeId
- Nullability
- Regex
- compiled regex backed by a lazy DFA.
- Regex
Builder
Enums§
- Error
- error from compiling or matching a regex.
- Unicode
Mode - configuration for pattern compilation and engine behavior.
Functions§
- escape
- escape all resharp meta characters in
text, returning a pattern that matches the literal string. - escape_
into - like
escapebut appends to an existing buffer. escapes all resharp meta characters intextand appends tobuf.