简体   繁体   中英

What is similar function in snowflake for REGEXP_EXTRACT function in Bigquery?

Bigquery :

SELECT *,
    REGEXP_EXTRACT(AM_EMAIL, '^[a-zA-Z0-9_.+-]+') as x_ALIAS,
    "https:" AS COL1
FROM `agm-data-.global_i.P_ROUTING`;

Want to Convert this bigquery into Snowflake ,Please suggest on REGEXP_EXTRACT Bigquery similar function in snowflake?

In Snowflake you would use REGEXP_SUBSTR() . The regex you are using should work just fine, so:

REGEXP_EXTRACT(AM_EMAIL, '^[a-zA-Z0-9_.+-]+') as x_ALIAS

Note that [a-zA-Z0-9_] can also be expressed as [:alnum:] , so:

REGEXP_EXTRACT(AM_EMAIL, '^[[:alnum:].+-]+') as x_ALIAS

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