summaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-11-25 14:25:11 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-11-26 22:06:27 -0500
commit527595f79bf97bc2d17cb821c8bb6b4e8b6776f9 (patch)
tree848035c9eb864e872999ca22d8ac5e15e8c3a9fa /ext/bg
parent1daed122909532f5ec5c4b470ddf7f791944cf73 (diff)
Remove unnecessary escapes from regex literals
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/js/audio.js4
-rw-r--r--ext/bg/js/dictionary.js2
-rw-r--r--ext/bg/js/search.js4
3 files changed, 5 insertions, 5 deletions
diff --git a/ext/bg/js/audio.js b/ext/bg/js/audio.js
index 9bbbf902..dc0ba5eb 100644
--- a/ext/bg/js/audio.js
+++ b/ext/bg/js/audio.js
@@ -107,7 +107,7 @@ const audioUrlBuilders = {
'custom': async (definition, optionsContext) => {
const options = await apiOptionsGet(optionsContext);
const customSourceUrl = options.audio.customSourceUrl;
- return customSourceUrl.replace(/\{([^\}]*)\}/g, (m0, m1) => (hasOwn(definition, m1) ? `${definition[m1]}` : m0));
+ return customSourceUrl.replace(/\{([^}]*)\}/g, (m0, m1) => (hasOwn(definition, m1) ? `${definition[m1]}` : m0));
}
};
@@ -133,7 +133,7 @@ function audioUrlNormalize(url, baseUrl, basePath) {
// Begins with "/"
url = baseUrl + url;
}
- } else if (!/^[a-z][a-z0-9\+\-\.]*:/i.test(url)) {
+ } else if (!/^[a-z][a-z0-9\-+.]*:/i.test(url)) {
// No URI scheme => relative path
url = baseUrl + basePath + url;
}
diff --git a/ext/bg/js/dictionary.js b/ext/bg/js/dictionary.js
index affce9e9..409bed85 100644
--- a/ext/bg/js/dictionary.js
+++ b/ext/bg/js/dictionary.js
@@ -322,7 +322,7 @@ async function dictFieldFormat(field, definition, mode, options, exceptions) {
compactGlossaries: options.general.compactGlossaries
};
const markers = dictFieldFormat.markers;
- const pattern = /\{([\w\-]+)\}/g;
+ const pattern = /\{([\w-]+)\}/g;
return await stringReplaceAsync(field, pattern, async (g0, marker) => {
if (!markers.has(marker)) {
return g0;
diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js
index ae76c23b..552b7a59 100644
--- a/ext/bg/js/search.js
+++ b/ext/bg/js/search.js
@@ -207,7 +207,7 @@ class DisplaySearch extends Display {
async onSearchQueryUpdated(query, animate) {
try {
const details = {};
- const match = /[\*\uff0a]+$/.exec(query);
+ const match = /[*\uff0a]+$/.exec(query);
if (match !== null) {
details.wildcard = true;
query = query.substring(0, query.length - match[0].length);
@@ -356,7 +356,7 @@ class DisplaySearch extends Display {
}
static getSearchQueryFromLocation(url) {
- let match = /^[^\?#]*\?(?:[^&#]*&)?query=([^&#]*)/.exec(url);
+ let match = /^[^?#]*\?(?:[^&#]*&)?query=([^&#]*)/.exec(url);
return match !== null ? decodeURIComponent(match[1]) : null;
}
}