(keyword, flags)
| 50 | } |
| 51 | |
| 52 | function createKeywordPattern(keyword, flags) { |
| 53 | const escapedKeyword = escapeRegex(keyword).replace(/\s+/g, "\\s+"); |
| 54 | return new RegExp(`(^|[^A-Za-z0-9])${escapedKeyword}(?=$|[^A-Za-z0-9])`, flags); |
| 55 | } |
| 56 | |
| 57 | function escapeRegex(value) { |
| 58 | return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); |
no test coverage detected