implement regex engine for handling regexes like `^(<match at most one codepoint>){m,n}$`
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 4k
- Forks
- 534
- PR merge metrics
- No merged PRs in 30d
Description
What version of regex are you using?
1.5.4
Describe the bug at a high level.
I use regexes to validate string inputs. Usually the strings are fairly small and there are no issues. Today I wanted to accept any text as long as it is shorter than 10000 unicode codepoints. I expected the following regex to work ^(?s:.){0,10000}$.
This triggered a CompiledTooBig(10485760) error instead.
What are the steps to reproduce the behavior?
Code:
fn main() {
let re = regex::Regex::new(r"^(?s:.){0,10000}$").unwrap();
dbg!(re);
}
What is the actual behavior?
Output:
Compiling playground v0.0.1 (/playground)
Finished dev [unoptimized + debuginfo] target(s) in 3.51s
Running `target/debug/playground`
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: CompiledTooBig(10485760)', src/main.rs:2:54
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
What is the expected behavior?
The regex should compile and be reasonably small. It looks like the memory requirements grow very large with the maximum string length checked by this regex.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Rust reproduction using Regex::new and the pattern ^(?s:.){0,10000}$, then trace how this expression is compiled and where CompiledTooBig is produced. Done means the expression compiles within a reasonably small memory footprint instead of returning CompiledTooBig, while preserving the regex engine's behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100