Skip to content

An error when parsing regex. #855

@zigazajc007

Description

@zigazajc007

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions