* Creates a cached regex pattern to avoid recompiling * @param {string} pattern - The regex pattern string * @param {string} flags - The regex flags * @returns {RegExp} The compiled regex pattern
(pattern, flags = "")
| 64 | * @returns {RegExp} The compiled regex pattern |
| 65 | */ |
| 66 | function createCachedRegex (pattern, flags = "") { |
| 67 | const key = `${pattern}|${flags}`; |
| 68 | |
| 69 | if (!regexCache.has(key)) { |
| 70 | regexCache.set(key, new RegExp(pattern, flags)); |
| 71 | } |
| 72 | |
| 73 | return regexCache.get(key); |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Converts a pattern string to a regex pattern with wildcard handling |