Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bbqsrc/regex-static
Compile-time validated regex, with convenience functions for lazy and static regexes.
https://github.com/bbqsrc/regex-static
compile-time lazy regex rust static
Last synced: about 2 months ago
JSON representation
Compile-time validated regex, with convenience functions for lazy and static regexes.
- Host: GitHub
- URL: https://github.com/bbqsrc/regex-static
- Owner: bbqsrc
- Created: 2021-03-04T18:14:36.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-29T08:21:21.000Z (8 months ago)
- Last Synced: 2024-10-12T03:13:28.037Z (2 months ago)
- Topics: compile-time, lazy, regex, rust, static
- Language: Rust
- Homepage:
- Size: 12.7 KB
- Stars: 6
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# regex_static
Compile-time validation of [`regex::Regex`](https://github.com/rust-lang/regex).
## Examples
### Lazy regex
Uses `once_cell` to lazily create the regex.
```rust
static RE: Lazy = regex_static::lazy_regex!("^yesss$");
```### Static regex
Also uses `once_cell`, but works inline (will therefore reuse the same instance of the regex each function call).
```rust
let some_regex = regex_static::static_regex!("^yesss$");
```### Ordinary regex
Will create an owned `Regex`, just like calling `Regex::new(...)` but with compile-time validation.
```rust
let ordinary_regex = regex_static::regex!("^yesss$");
```