(literal: string)
| 101 | * @returns Escaped string safe for regex use |
| 102 | */ |
| 103 | export function escapeLiteralForRegex(literal: string): string { |
| 104 | // Escape all regex metacharacters |
| 105 | return literal.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * Detects if a query looks like it's meant to be a literal search |
no test coverage detected