zhiqiang-hhhh commented on code in PR #30557:
URL: https://github.com/apache/doris/pull/30557#discussion_r1470767592
##########
be/src/vec/functions/like.cpp:
##########
@@ -447,43 +445,39 @@ void FunctionLike::convert_like_pattern(LikeSearchState*
state, const std::strin
}
// add ^ to pattern head to match line head
- if (pattern.size() > 0 && pattern[0] != '%') {
+ if (!pattern.empty() && pattern[0] != '%') {
re_pattern->append("^");
}
bool is_escaped = false;
- for (size_t i = 0; i < pattern.size(); ++i) {
- if (!is_escaped) {
- switch (pattern[i]) {
+ for (char i : pattern) {
+ if (is_escaped) { // the last one is '/' or specific escape char
+ re_pattern->append(1, i);
Review Comment:
if you want to escape them maybe need to insert a '\\' before them?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]