mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-09-05 23:47:43 +08:00
✨ Feature(custom): add u flag for gallery regexp match
This commit is contained in:
@@ -182,7 +182,7 @@ export const svg = `
|
|||||||
export function customStrMatch (str: string, pattern: string) : boolean {
|
export function customStrMatch (str: string, pattern: string) : boolean {
|
||||||
if (!str || !pattern) return false
|
if (!str || !pattern) return false
|
||||||
try {
|
try {
|
||||||
const reg = new RegExp(pattern, 'g')
|
const reg = new RegExp(pattern, 'ug')
|
||||||
return reg.test(str)
|
return reg.test(str)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
@@ -195,7 +195,7 @@ export function customStrReplace (str: string, pattern: string, replacement: str
|
|||||||
replacement = replacement || ''
|
replacement = replacement || ''
|
||||||
let result = str
|
let result = str
|
||||||
try {
|
try {
|
||||||
const reg = new RegExp(pattern, 'g')
|
const reg = new RegExp(pattern, 'ug')
|
||||||
result = str.replace(reg, replacement)
|
result = str.replace(reg, replacement)
|
||||||
result = renameFileNameWithCustomString(result, result, str)
|
result = renameFileNameWithCustomString(result, result, str)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user