-
Notifications
You must be signed in to change notification settings - Fork 51
Regex Matcher Fails On Valid Inputs #214
Copy link
Copy link
Closed
Description
The regex library used by pact_matching fails on valid input. Take the following example:
use onig::Regex;
fn main() {
let regex_string = "Greater|GreaterOrEqual";
let re = Regex::new(regex_string).unwrap();
println!("Regex: {regex_string}");
check(&re, "Greater");
check(&re, "GreaterOrEqual");
}
fn check(regex: &Regex, input: &str) {
let matched = regex.is_match(input);
println!("Input: {input} - {matched}");
}This produces the output:
Regex: Greater|GreaterOrEqual
Input: Greater - true
Input: GreaterOrEqual - false
If you swap the regex around to the opposite order then it passes:
Regex: GreaterOrEqual|Greater
Input: Greater - true
Input: GreaterOrEqual - true
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels