Remove unnecessary escapes from regex literals
This commit is contained in:
parent
1daed12290
commit
527595f79b
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
|
||||
const REGEX_TRANSPARENT_COLOR = /rgba\s*\([^\)]*,\s*0(?:\.0+)?\s*\)/;
|
||||
const REGEX_TRANSPARENT_COLOR = /rgba\s*\([^)]*,\s*0(?:\.0+)?\s*\)/;
|
||||
|
||||
function docSetImposterStyle(style, propertyName, value) {
|
||||
style.setProperty(propertyName, value, 'important');
|
||||
|
@ -303,7 +303,7 @@ class Popup {
|
||||
}
|
||||
|
||||
static getColorInfo(cssColor) {
|
||||
const m = /^\s*rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d\.]+)\s*)?\)\s*$/.exec(cssColor);
|
||||
const m = /^\s*rgba?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+)\s*)?\)\s*$/.exec(cssColor);
|
||||
if (m === null) { return null; }
|
||||
|
||||
const m4 = m[4];
|
||||
|
@ -68,7 +68,7 @@ class TextToSpeechAudio {
|
||||
}
|
||||
|
||||
static createFromUri(ttsUri) {
|
||||
const m = /^tts:[^#\?]*\?([^#]*)/.exec(ttsUri);
|
||||
const m = /^tts:[^#?]*\?([^#]*)/.exec(ttsUri);
|
||||
if (m === null) { return null; }
|
||||
|
||||
const searchParameters = {};
|
||||
|
Loading…
Reference in New Issue
Block a user