2020. nov 13.

Simple Regex in Bigquery

írta: dataanalyticsdemo
Simple Regex in Bigquery

So one day I woke up and I was like:

4mb3mu.jpg

So I booted up my free account and started typing:

with test as (
select 'ABCD1234' as field)

select regexp_extract(field, '[0-9]{1,3}') as extracted from test --retunrs 123
union all
select regexp_extract(field, '[0-9]{1,4}') as extracted from test -- returns 1234
union all
select regexp_extract(field, '[A-Z,0-9]{1,7}')from test

 

 

 

Szólj hozzá

SQL Regex Bigquery