Skip to content

Replace doesn't work as expected with \b #397

@emilio

Description

@emilio

Feel free to close if this is really behaving as expected.

The following code:

extern crate regex;

use regex::Regex;

fn main() {
    let mut result = "                pub mErrorLine: root::nsTString<u16>,".to_owned();
    let r = Regex::new(r"\broot::nsTString<u16>\b").unwrap();
    
    result = r.replace_all(&result, "::nsstring::nsStringRepr").to_string();
    
    println!("{:?}", result);
}

Will not be able to replace the root::nsTString<u16>, while removing the last \b from the regex does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions