mkevo commented on a change in pull request #6044:
URL: https://github.com/apache/geode/pull/6044#discussion_r582591477
##########
File path:
geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledLike.java
##########
@@ -349,6 +349,30 @@ private String getRegexPattern(String pattern) {
sb.append(ch);
}
break;
+ case '$': // replace with [$]
+ if (prevMetaChar) {
+ sb.append('\\');
+ sb.append('E');
+ prevMetaChar = false;
+ }
+
+ numConsecutiveBackSlash = 0;
+ for (int j = i - 1; j > -1; --j) {
+ if (pattern.charAt(j) == '\\') {
+ ++numConsecutiveBackSlash;
+ } else {
+ break;
+ }
+ }
+
+ // Check if the $ has a valid escape. Backtrack to check for \.
Review comment:
When it use the compare operation it checks string, but when using LIKE
operation it check character by character, and when comes to "$" character it
present it like endline character and cannot got right results. Now with
escaping it will check if string has "$" character and compare it like any
other character.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]