You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: Spark RLIKE regex escapes are removed in SQLGlot 30.21.0 #8554
In SQLGlot 30.21.0, parsing Snowflake SQL with RLIKE appears to remove backslashes from escaped regex characters. This changes the meaning of the regex and can produce invalid or incorrect Snowflake SQL.
The escaped regex tokens lose their backslashes, changing:
\s* -> s*
\. -> .
\* -> *
This changes the intended regex semantics. In particular, \* is intended to match a literal asterisk, but after the backslash is removed it becomes *, which is a regex quantifier.
This was found from a dbt model macro containing this pattern:
@georgesittas I was looking back at this issue yesterday, I realize that my issue wasn't clear. It's not with escapes themselves in RLike functions, my RLike statement, as seen above, utilizes reg(\s*|-|\.|\*), and it is here that SQLglot is stripping the escapes out of the reg() function. This behavior is still happening in SQLGlot 30.22.0
Please open a new issue with exact steps to reproduce the bug. Show exactly what you're doing (including driving python code) and how the input vs output produces different results in the engine. Thanks!
Activity
georgesittas commentedon Oct 7, 2026
This is already fixed in main. Minimal reproduction on the latest checkout (
542c64b4c):Both engines return these results:
ptmertka commentedon Oct 14, 2026
@georgesittas I was looking back at this issue yesterday, I realize that my issue wasn't clear. It's not with escapes themselves in RLike functions, my RLike statement, as seen above, utilizes reg(\s*|-|\.|\*), and it is here that SQLglot is stripping the escapes out of the reg() function. This behavior is still happening in SQLGlot 30.22.0
georgesittas commentedon Oct 14, 2026
Please open a new issue with exact steps to reproduce the bug. Show exactly what you're doing (including driving python code) and how the input vs output produces different results in the engine. Thanks!