Fix regex conditions returning true for partial matches

The regex engine implicitly adds .*? to the beginning and end of
expressions, so add ^ and $ to input expressions.
This commit is contained in:
Oliver Hamlet
2019-07-23 19:04:22 +01:00
parent 214cc93423
commit b9d5d57dac
2 changed files with 15 additions and 8 deletions
+1 -1
View File
@@ -464,7 +464,7 @@ mod tests {
let error = Expression::from_str("file(\"Carg\\.*(\")").unwrap_err();
assert_eq!(
"An error was encountered while parsing the expression \"Carg\\.*(\": regex parse error:\n Carg\\.*(\n ^\nerror: unclosed group",
"An error was encountered while parsing the expression \"Carg\\.*(\": regex parse error:\n ^Carg\\.*($\n ^\nerror: unclosed group",
error.to_string()
);
}