0

How do I extract only 1111111 from a product_name column like this in Bigquery:

AB~1111111|Omega | Shoes

I tried the following:

REGEXP_EXTRACT(product_name, r"^([0-9]+)|") AS Product_ID

1 Answer 1

2

You need to use

REGEXP_EXTRACT(product_name, r"^\D*(\d+)") AS Product_ID

See the regex demo

Details:

  • ^ - string start
  • \D* - zero or more non-digits
  • (\d+) - Group 1: one or more digits.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.