Run macro: Sub TestLike Dim s As String s="ab" & Chr(10) & "cd" Msgbox s Like "a*" End Sub Returns False, must be True. The error occurs when the string being tested contains characters U+000A, U+000B, U+000C, U+000D.
Indeed this example returns False. The method IsLike from the String service (ScriptForge) also returns False. I'm not sure whether this should return True... but I can't see a reason why not. The weird thing is that I could not find the help page for the Like operator. It's possibly lacking documentation. Code pointer here: SbiExpression::Like in /core/basic/source/comp/exprtree.cxx
Rafael, thank you for participating in the topic. Added a link to a bug about the lack of documentation for the Like operator.
It must return True here, because LIKE operator, by definition, matches the string against the pattern, not some part of the string, arbitrarily separated by newline characters. https://gerrit.libreoffice.org/c/core/+/165700
Mike, thank you for quickly fixing the bug! :)
Mike Kaganski committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/38f731ff67142a423aa6f46dc3e92d094f86ffb1 tdf#160478: fix Basic LIKE operator It will be available in 24.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Mike Kaganski committed a patch related to this issue. It has been pushed to "libreoffice-24-2": https://git.libreoffice.org/core/commit/b4abb5ee77c6894cd9a9ef3d5f66e868b591d02c tdf#160478: fix Basic LIKE operator It will be available in 24.2.3. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.