07 Apr 19 · npack · #bigquery ·   Bookmark   ×

Solved: Bigquery Error - Illegal Escape Sequence while using REGEXP

When trying to run a regex on a column in Bigquery, It throws the below error message:

Example:

when regexp_contains((user_agent), '^AppleCoreMedia\/1\.(.*)iPod') then "iOS"
Syntax error: Illegal escape sequence: \/ at [4:63]

Solution:

Try the below syntax:

regexp_contains((user_agent),  r'^AppleCoreMedia\/1\.(.*)iPod')

npack

posted on 07 Apr 19

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds