-
Notifications
You must be signed in to change notification settings - Fork 469
Closed
Labels
Description
What version of regex are you using?
1.5.5
Describe the bug at a high level.
An error when parsing regex.
What are the steps to reproduce the behavior?
use regex::Regex;
struct Validate{}
impl Validate{
fn password(password:&str)->bool{
return Regex::new(r"^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&,_\(\)\=\-\.])[A-Za-z\d@$!%*#?&,_\(\)\=\-\.]{8,255}$").unwrap().is_match(password);
}
}
fn main() {
println!("Is password valid? {}", Validate::password("RandomGeneratedPassword123!"));
}
What is the actual behavior?
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Syntax(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
regex parse error:
^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&,_\(\)\=\-\.])[A-Za-z\d@$!%*#?&,_\(\)\=\-\.]{8,255}$
^^^
error: look-around, including look-ahead and look-behind, is not supported
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
)', src/main.rs:11:121
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
What is the expected behavior?
To be able to parse this regex. The same regex also works in PHP and JavaScript.