mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-13 06:49:05 -05:00
Add warning if regex contains two or more wildcards
* Find that replaces std::regex currently does not support two or more wildcards in an expression
This commit is contained in:
@@ -89,6 +89,17 @@ void applyRegularExpression(lua_State* L, const std::string& regex,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (regex.find_first_of("*", wildPos + 1) != std::string::npos) {
|
||||
LERRORC(
|
||||
"applyRegularExpression",
|
||||
fmt::format(
|
||||
"Malformed regular expression: '{}': "
|
||||
"Currently only one '*' is supported", regex
|
||||
)
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Else search for the literal string without regex
|
||||
else {
|
||||
@@ -468,6 +479,17 @@ int property_getProperty(lua_State* L) {
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (regex.find_first_of("*", wildPos + 1) != std::string::npos) {
|
||||
LERRORC(
|
||||
"property_getProperty",
|
||||
fmt::format(
|
||||
"Malformed regular expression: '{}': "
|
||||
"Currently only one '*' is supported", regex
|
||||
)
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
// Else search for the literal string without regex
|
||||
else {
|
||||
@@ -643,6 +665,17 @@ int removeSceneGraphNodesFromRegex(lua_State* L) {
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (name.find_first_of("*", wildPos + 1) != std::string::npos) {
|
||||
LERRORC(
|
||||
"removeSceneGraphNodesFromRegex",
|
||||
fmt::format(
|
||||
"Malformed regular expression: '{}': "
|
||||
"Currently only one '*' is supported", name
|
||||
)
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
// Else search for the literal string without regex
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user