Handleded for this test case - o. w
This commit is contained in:
parent
2bcfd01784
commit
1186ae81a7
@ -45,6 +45,8 @@ const CHARACTERS_TO_NORMALIZE = {
|
|||||||
"\u00BE": "3/4", // Vulgar fraction three quarters
|
"\u00BE": "3/4", // Vulgar fraction three quarters
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const escapeForRegex = str => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||||
|
|
||||||
// These diacritics aren't considered as combining diacritics
|
// These diacritics aren't considered as combining diacritics
|
||||||
// when searching in a document:
|
// when searching in a document:
|
||||||
// https://searchfox.org/mozilla-central/source/intl/unicharutil/util/is_combining_diacritic.py.
|
// https://searchfox.org/mozilla-central/source/intl/unicharutil/util/is_combining_diacritic.py.
|
||||||
@ -78,7 +80,7 @@ let DIACRITICS_EXCEPTION_STR; // Lazily initialized, see below.
|
|||||||
|
|
||||||
const DIACRITICS_REG_EXP = /\p{M}+/gu;
|
const DIACRITICS_REG_EXP = /\p{M}+/gu;
|
||||||
const SPECIAL_CHARS_REG_EXP =
|
const SPECIAL_CHARS_REG_EXP =
|
||||||
/([.*+?^${}()|[\]\\])|(\p{P})|(\s+)|(\p{M})|(\p{L})/gu;
|
/([*+^${}()|[\]\\])|((?:[.?]|\p{P})+)|(\s+)|(\p{M})|(\p{L})/gu;
|
||||||
const NOT_DIACRITIC_FROM_END_REG_EXP = /([^\p{M}])\p{M}*$/u;
|
const NOT_DIACRITIC_FROM_END_REG_EXP = /([^\p{M}])\p{M}*$/u;
|
||||||
const NOT_DIACRITIC_FROM_START_REG_EXP = /^\p{M}*([^\p{M}])/u;
|
const NOT_DIACRITIC_FROM_START_REG_EXP = /^\p{M}*([^\p{M}])/u;
|
||||||
|
|
||||||
@ -732,7 +734,9 @@ class PDFFindController {
|
|||||||
}
|
}
|
||||||
if (p2) {
|
if (p2) {
|
||||||
// Punctuation: allow optional spaces ONLY if the user typed spaces.
|
// Punctuation: allow optional spaces ONLY if the user typed spaces.
|
||||||
return queryHasWhitespace ? `[ ]*${p2}[ ]*` : `${p2}`;
|
// p2 is a *run* of punctuation; escape it as a whole.
|
||||||
|
const escapedRun = escapeForRegex(p2);
|
||||||
|
return queryHasWhitespace ? `[ ]*${escapedRun}[ ]*` : `${escapedRun}`;
|
||||||
}
|
}
|
||||||
if (p3) {
|
if (p3) {
|
||||||
// Replace spaces by \s+ to be sure to match any spaces.
|
// Replace spaces by \s+ to be sure to match any spaces.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user