mirror of
https://github.com/element-plus/element-plus.git
synced 2025-08-17 04:51:51 +08:00
refactor(utils): improve escapeStringRegexp (#6013)
This commit is contained in:
@ -5,5 +5,8 @@ export {
|
||||
hyphenate as kebabCase, // alias
|
||||
} from '@vue/shared'
|
||||
|
||||
export const escapeRegexpString = (value = '') =>
|
||||
String(value).replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
|
||||
/**
|
||||
* fork from {@link https://github.com/sindresorhus/escape-string-regexp}
|
||||
*/
|
||||
export const escapeStringRegexp = (string = '') =>
|
||||
string.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d')
|
||||
|
Reference in New Issue
Block a user