Skip to content

Valid regex throws error "Could not parse expression" #8

Open
@qarmin

Description

@qarmin

Regex

(|(20\/([^0179]0|[1234]00|25|125|160|250)|6\/([69]|1[258]|[369]0|[34]8|7\.5|24|75|120)|(1\.0|0\.(0[58]|[12458]0|067|67|16|125|25|33))))

is supported both by Regex crate and Qt, but this crate throws error

could not parse expression
```


Test crate
```
use rand::Rng;
use regex::Regex;

const LIMIT : usize = 1000;

fn main() {
    let mut rng = rand::thread_rng();
    let re = r"(|(20\/([^0179]0|[1234]00|25|125|160|250)|6\/([69]|1[258]|[369]0|[34]8|7\.5|24|75|120)|(1\.0|0\.(0[58]|[12458]0|067|67|16|125|25|33))))";
    let tt = Regex::new(re).unwrap();
    dbg!(tt);
    let mut generator = regex_generate::Generator::new(&re, &mut rng, 1000).unwrap();
    for _ in 0..LIMIT {
        let mut buffer : Vec<u8> = Vec::new();
        generator.generate(&mut buffer).unwrap();
        println!("{}", String::from_utf8(buffer).unwrap());
    }
}

```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions