diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-12-21 12:51:36 +0300 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2020-01-03 20:51:28 +0100 |
commit | 12b4590f3a9ba64bcc27e60185ee7366d9894cc7 (patch) | |
tree | e9a776f1980a23e2d59d243f22c73a24bd7ea44b /i18npool/source/search | |
parent | 4fbd76beb57db9a1261efecf5cfac4cae6fe839b (diff) |
tdf#78840: disable case-insensitive transliteration for regex search
Allow regex engine use its own case-insensitive search instead. We
already set UREGEX_CASE_INSENSITIVE ICU flag when case-insensitive
search is requested in TextSearch::RESrchPrepare. Case-insensitive
transliteration used when preparing the string for passing to regex
engine creates a lowercase string, where case-sensitive search is
impossible, even when regex includes explicit flags for that.
This change allows to honor (?-i)/(?i) flags in the regex if present.
It removes case-sensitive flag from consideration for creation of
transliteration service if regex search is requested.
Change-Id: I0d8960670c1681f7c6bc162a4f858006596c7c36
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85650
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'i18npool/source/search')
-rw-r--r-- | i18npool/source/search/textsearch.cxx | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/i18npool/source/search/textsearch.cxx b/i18npool/source/search/textsearch.cxx index 2bb947f9ec73..9c3bf63eeb64 100644 --- a/i18npool/source/search/textsearch.cxx +++ b/i18npool/source/search/textsearch.cxx @@ -130,6 +130,9 @@ void TextSearch::setOptions2( const SearchOptions2& rOptions ) maWildcardReversePattern.clear(); maWildcardReversePattern2.clear(); TransliterationFlags transliterateFlags = static_cast<TransliterationFlags>(aSrchPara.transliterateFlags); + if (aSrchPara.AlgorithmType2 == SearchAlgorithms2::REGEXP) + // RESrchPrepare will consider SearchAlgorithms2::REGEXP in aSrchPara.transliterateFlags + transliterateFlags &= ~TransliterationFlags::IGNORE_CASE; // Create Transliteration class if( isSimpleTrans( transliterateFlags) ) |