Skip to content Skip to sidebar Skip to footer

Python Error Because Of Regex Inside A Google Big Query

I am writing Google Big Query wrappers in python. One of the queries has a regex and the python code is treating it as an syntax error. Here is the regex WHEN tier2 CONTAINS '-' T

Solution 1:

You need to escape backslash by preceding it with yet another backslash Backslash \ is an escape character so you need to escape it so it is treated as a normal character

Try

'(.*)\\s-'

Based on your comments, looks like above is exactly what you are using in BigQuery - so in this case you need to escape each of two backslashes

'(.*)\\\\s-'

Post a Comment for "Python Error Because Of Regex Inside A Google Big Query"