Skip to content

incorrect parsing of regex? #280

@blaenk

Description

@blaenk

I hadn't worked with rust in months so I made major updates of both rustc and my dependencies (including regex). I noticed that my program was now failing in a weird way and I finally tracked it down to this bug (regression?), either that or I'm doing something very wrong here:

let re = Regex::new(r"(^\.)|(~$)").unwrap();
assert!(!re.is_match("favicon.png"));

That assertion is failing even though it shouldn't AFAIK. It certainly didn't before.

The regex is supposed to match if the string begins with . or ends with ~. Even without the groupings/capture groups it fails. Somehow it is matching on "favicon.png".

I can't imagine something like this got through though so I'm thinking it may be a misunderstanding I have of how that regex should work. I tried this just now in the chrome console with javascript and I don't see this problem there, though I am aware that regex implementations tend to differ, I wasn't aware that they differ in something like this.

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