Исправления багов поиска по рег. выражению

This commit is contained in:
Book Pauk
2022-12-09 18:31:41 +07:00
parent 85bf7296ef
commit bd2551559b
3 changed files with 8 additions and 8 deletions

View File

@@ -71,8 +71,8 @@ class DbSearcher {
a = a.substring(1);
where = `
await (async() => {
const re = new RegExp(${db.esc(a)}, 'gi');
@@indexIter('value', (v) => re.exec(v) );
const re = new RegExp(${db.esc(a)}, 'i');
@@indexIter('value', (v) => re.test(v) );
})()
`;
} else {
@@ -577,8 +577,8 @@ class DbSearcher {
return `
(() => {
const re = new RegExp(${db.esc(searchValue)}, 'gi');
return re.exec(row.${bookField});
const re = new RegExp(${db.esc(searchValue)}, 'i');
return re.test(row.${bookField});
})()
`;
} else {

View File

@@ -256,8 +256,8 @@ class BasePage {
} else if (searchValue[0] == '~') {//RegExp
searchValue = searchValue.substring(1);
const re = new RegExp(searchValue, 'gi');
return re.exec(bookValue);
const re = new RegExp(searchValue, 'i');
return re.test(bookValue);
} else {
//where = `@dirtyIndexLR('value', ${db.esc(a)}, ${db.esc(a + maxUtf8Char)})`;
return bookValue.localeCompare(searchValue) >= 0 && bookValue.localeCompare(searchValue + maxUtf8Char) <= 0;