tdf#160478: fix Basic LIKE operator
commit38f731ff67142a423aa6f46dc3e92d094f86ffb1
authorMike Kaganski <mike.kaganski@collabora.com>
Tue, 2 Apr 2024 15:34:00 +0000 (2 20:34 +0500)
committerMike Kaganski <mike.kaganski@collabora.com>
Tue, 2 Apr 2024 17:47:35 +0000 (2 19:47 +0200)
tree92031cd3dde49eb37634de2b954b497301ab13be
parent0fb98963c46013209d39c03c3d61ef52ccc504e2
tdf#160478: fix Basic LIKE operator

1. The regex must match the whole input. Thus, the ^ and $ metacharacters
   must be replaced with \A and \z, which only match beginning and end of
   input, not any line start / end.
2. The * and ? metacharacters of LIKE must match newline character; thus,
   search flags must include UREGEX_DOTALL. To avoid changing TextSearch
   implementation, I use icu::RegexMatcher directly.

The direct use of icu::RegexMatcher also allowed to simplify the code by
calling icu::RegexMatcher::matches method.  This may perform better than
general-purpose utl::TextSearch::SearchForward.

Change-Id: I75776498b36f236da294462362ed5b36ed8cdf68
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165700
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
basic/CppunitTest_basic_scanner.mk
basic/Library_sb.mk
basic/source/runtime/runtime.cxx