Skip to content
Advertisement

A string does not contain a number

Looking for addresses in a table that does not contain a number

So “Smith Street” or “James Road” etc

I tried using:

address_street not like '%[0-9]%'

but this did not work, as the results returned everything that is not literally that string.

Advertisement

Answer

For this kind of investigation with strings you can use regular expressions and the corresponding functions offered by BigQuery. For instance with REGEX_CONTAINS:

with sample as (
    select "39, Albert street" AS address_street
    union all select "Private Drive"
    union all select "10, Downing Street"
    union all select "Buckingham palace"
)

select * from sample 
where not regexp_contains(address_street, r'd')

returns

enter image description here

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement