stripSqlNoise

internal fun stripSqlNoise(sql: String): String

Strips string literals and comments from a SQL string, replacing them with a single space.

This is used before keyword matching so that SQL keywords appearing inside string literals or comments do not falsely trigger validation rules.

Handles:

  • single-quoted string literals '...' with '' escape sequences

  • double-quoted identifiers "..."

  • single-line comments -- ...

  • block comments /* ... */

Dollar-quoted strings (PostgreSQL `...