MCPcopy Create free account
hub / github.com/appium/appium / toExactMatchPattern

Function toExactMatchPattern

packages/logger/lib/secure-values-preprocessor.ts:151–155  ·  view source on GitHub ↗

* Transforms the given text to a pattern, which does not match if the * text is only a part of a longer word. * * `\b` only asserts a boundary next to a word character, so it is only added * to the sides where the text itself begins or ends with one. Otherwise values * like `P@ssw0rd!` would ne

(text: string)

Source from the content-addressed store, hash-verified

149 * @returns {string} The resulting regular expression source
150 */
151function toExactMatchPattern(text: string): string {
152 const prefix = /^\w/.test(text) ? '\\b' : '';
153 const suffix = /\w$/.test(text) ? '\\b' : '';
154 return `${prefix}${escapeRegExp(text)}${suffix}`;
155}

Callers 1

parseRuleMethod · 0.85

Calls 1

escapeRegExpFunction · 0.50

Tested by

no test coverage detected