Rust regex pattern - unrecognized escape pattern
问题 I do have following string: \"lengthSeconds\":\"2664\" which I would like to match with this regexp: Regex::new("lengthSeconds\\\":\\\"(\\d+)\\\"") I even tried this: Regex::new(r#"lengthSeconds\":\"(\d+)\""#) but I'm getting this: regex parse error: lengthSeconds\":\"(\d+)\" ^^ error: unrecognized escape sequence What's wrong with the regexp pattern? 回答1: By using r#..#, you treat your string as a raw string and hence do not process any escapes. However, since backslashes are special