MCPcopy Create free account
hub / github.com/CatMuse/HiNote / escapeRegExp

Method escapeRegExp

src/utils/HighlightRegexUtils.ts:9–11  ·  view source on GitHub ↗

* 转义正则表达式中的特殊字符

(string: string)

Source from the content-addressed store, hash-verified

7 * 转义正则表达式中的特殊字符
8 */
9 static escapeRegExp(string: string): string {
10 return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
11 }
12
13 /**
14 * 移除文本中的高亮格式,保留纯文本

Callers 2

removeHighlightFormatMethod · 0.95

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected