push: Use bytes Regex to fix regex construction
Due to a new error detected in the regex crate.
This commit is contained in:
parent
0143bd9b9f
commit
ed7c26ff9f
@ -1,7 +1,7 @@
|
||||
use std::{collections::BTreeMap, ops::RangeBounds, str::FromStr};
|
||||
|
||||
use js_int::{Int, UInt};
|
||||
use regex::Regex;
|
||||
use regex::bytes::Regex;
|
||||
#[cfg(feature = "unstable-msc3931")]
|
||||
use ruma_macros::StringEnum;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@ -392,7 +392,7 @@ impl StrExt for str {
|
||||
// The word characters in ASCII compatible mode (with the `-u` flag) match the
|
||||
// definition in the spec: any character not in the set `[A-Za-z0-9_]`.
|
||||
let regex = format!(r"(?-u:^|\W|\b){}(?-u:\b|\W|$)", chunks.concat());
|
||||
Regex::new(®ex).ok().filter(|re| re.is_match(self)).is_some()
|
||||
Regex::new(®ex).ok().filter(|re| re.is_match(self.as_bytes())).is_some()
|
||||
} else {
|
||||
match self.find(pattern) {
|
||||
Some(start) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user