static DeprecatedString RegExpFromGlob(DeprecatedString glob) { DeprecatedString result = glob; // escape regexp metacharacters which are NOT glob metacharacters result.replace(RegularExpression("\\\\"), "\\\\"); result.replace(RegularExpression("\\."), "\\."); result.replace(RegularExpression("\\+"), "\\+"); result.replace(RegularExpression("\\$"), "\\$"); // FIXME: incorrect for ^ inside bracket group result.replace(RegularExpression("\\^"), "\\^"); // translate glob metacharacters into regexp metacharacters result.replace(RegularExpression("\\*"), ".*"); result.replace(RegularExpression("\\?"), "."); // Require the glob to match the whole string result = "^" + result + "$"; return result; }
RegularExpression createSearchRegex(const String& query, bool caseSensitive, bool isRegex) { String regexSource = isRegex ? query : createSearchRegexSource(query); return RegularExpression(regexSource, caseSensitive ? TextCaseSensitive : TextCaseInsensitive); }
//------------------------------------------------------------------------------ bool ofxWebServerBaseRouteHandler::matchRoute(const URI& uri, const Settings& settings) { return RegularExpression(settings.path).match(uri.getPath()); }