namespace WrtDeviceApis {
namespace Commons {
-
std::string addStartPositionMark(const std::string &value)
{
if (!String::startsWith(value, "^") && !String::startsWith(value, ".*")) {
std::string addEndPositionMark(const std::string &value)
{
if ((!String::endsWith(value, "$") || String::endsWith(value, "\\$")) &&
- !String::endsWith(value, ".*")) {
+ !String::endsWith(value, ".*"))
+ {
return value + "$";
}
return value;
// Escape standard regular expressions' metacharacters,
// i.e.: \, ., -, +, ?, (, ), [, ], ^, $, |
const char* metas = "(\\.|\\-|\\+|\\?|\\(|\\)|\\[|\\]|\\^|\\$|\\|"
- "|(\\\\[^\\*\\%]|\\\\$))"; // \*, \% won't get additional '\'
+ "|(\\\\[^\\*\\%]|\\\\$))"; // \*, \% won't get
+ // additional '\'
pcrecpp::RE(metas).GlobalReplace("\\\\\\1", &result);
return result;
}
-
}
} // WrtDeviceApisCommon