简体   繁体   中英

Snowflake SQL - Invalid escape sequence when using Regexp_Like

I have been migrating something from a.netezza based SQL script into Snowflake, and part of one of my join clauses has the following lines:

AND regexp_like(hist.Description, p.RegexPattern, 'i')

This runs fine on Netezza, however when running within Snowflake I get the following error after about 2 minutes of run time:

100048 (2201B): Invalid regular expression: '^Renewal\b.*\bDraft\b.*\bPending\b\h+\bNon-Renewal\b.*', invalid escape sequence: \h

Has anyone ever encountered this error? A bit new to regexp_like function so it may be something simple, but haven't been able to find anything regarding a fix online. Not sure what the error is really telling me?

\h is a Perl 5 escape sequence to match horizontal whitespace per Perl Regular Expression Classes . Snowflake regular expressions don't appear to support \h. The closest alternative would be to use \s. Note that \s will match a few characters that \h will not, so you may want to verify whether you have any of those characters before making the substitution. See the Perl reference for details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM