summaryrefslogtreecommitdiff
path: root/ext/bg/js/search.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-11-23 21:48:24 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-07 14:34:35 -0500
commit16593408981d59e1bd3ad4de14071f45a8116d81 (patch)
treeec3d39929fd30c9ee1ab5bedb701d74760bf8f5b /ext/bg/js/search.js
parent7401408c39ee6097eb6c3e52635f87845832ce97 (diff)
Add support for prefix wildcards
Diffstat (limited to 'ext/bg/js/search.js')
-rw-r--r--ext/bg/js/search.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js
index d2e0fd56..67a78075 100644
--- a/ext/bg/js/search.js
+++ b/ext/bg/js/search.js
@@ -207,10 +207,14 @@ class DisplaySearch extends Display {
async onSearchQueryUpdated(query, animate) {
try {
const details = {};
- const match = /[*\uff0a]+$/.exec(query);
+ const match = /^([*\uff0a]*)([\w\W]*?)([*\uff0a]*)$/.exec(query);
if (match !== null) {
- details.wildcard = true;
- query = query.substring(0, query.length - match[0].length);
+ if (match[1]) {
+ details.wildcard = 'prefix';
+ } else if (match[3]) {
+ details.wildcard = 'suffix';
+ }
+ query = match[2];
}
const valid = (query.length > 0);