mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-03-13 08:28:13 -04:00
✨ Feature(custom): add u flag for gallery regexp match
This commit is contained in:
parent
0476346070
commit
aa9e535fd1
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user