Expand description
§use-regex
Practical regex helper utilities for RustUse.
Warning: versions below
0.3.0are experimental and may change as the workspace matures.
§Example Usage
use use_regex::{escape_regex, is_valid_regex};
assert_eq!(escape_regex("a+b"), "a\\+b");
assert!(is_valid_regex(r"\d+"));§Scope
- lightweight wrappers around the mature
regexcrate - simple validation, matching, extraction, and replacement helpers
- string-oriented utilities that stay small and predictable
§Non-Goals
- regex engine implementation
- parser generators
- validation frameworks
- security sandboxing
§License
Licensed under either of the following, at your option:
- MIT License
- Apache License, Version 2.0
Structs§
- Regex
Capture - A captured value and its byte span.
- Regex
Flags - Optional flags that can be applied when constructing a regex.
- Regex
Pattern - A reusable owned regex pattern wrapper.
Functions§
- count_
regex_ matches - Counts matches for a valid pattern.
- escape_
regex - Escapes regex metacharacters in a literal string.
- extract_
regex_ captures - Extracts capture groups across all matches for a valid pattern.
- extract_
regex_ matches - Extracts matched substrings for a valid pattern.
- has_
regex_ match - Returns
truewhen the pattern matches any part of the input. - is_
valid_ regex - Returns
truewhen the pattern compiles successfully. - looks_
like_ regex - Returns
truewhen the input appears to contain regex syntax. - regex_
ends_ with - Returns
truewhen a valid pattern matches at the end of the input. - regex_
starts_ with - Returns
truewhen a valid pattern matches at the beginning of the input. - replace_
regex_ all - Replaces all matches for a valid pattern.