Skip to content

Commit 60a6967

Browse files
authored
Use non-capturing group in arg pattern regex (#3006)
1 parent 7d4d87e commit 60a6967

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pattern.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ impl Pattern {
1818
.map_err(|source| token.error(CompileErrorKind::ArgumentPatternRegex { source }))?;
1919

2020
Ok(Self(
21-
format!("^({})$", literal.cooked)
21+
format!("^(?:{})$", literal.cooked)
2222
.parse::<Regex>()
2323
.map_err(|source| token.error(CompileErrorKind::ArgumentPatternRegex { source }))?,
2424
))
@@ -27,7 +27,7 @@ impl Pattern {
2727

2828
impl Display for Pattern {
2929
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
30-
write!(f, "{}", &self.0.as_str()[2..self.0.as_str().len() - 2])
30+
write!(f, "{}", &self.0.as_str()[4..self.0.as_str().len() - 2])
3131
}
3232
}
3333

0 commit comments

Comments
 (0)