Hello I am trying to extract the 7digit with a big query for extracting the 2670782 and 2670788 on this data
desc field data below
is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type 8888888 specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing 8888888 software like Aldus PageMaker including versions of Lorem Ipsum.
>> https://hello.com/pudding/answer/2670782?hl=en&ref_topic=7072943
>> https://hello.com/pudding/answer/2670788?hl=en&ref_topic=7072943
I have a query but there are also other 7digit number on the data other than the 2670782 and 2670788. so first I wanted to check if the line starts with ">>" and includes "hello.com" and I can extract it.
Here is the query that I have but it will grab the 8888888 as well which is not supposed to be.
SELECT
desc,
REGEXP_EXTRACT_ALL(desc, r"\/(\d{7})") AS num
FROM
`table`
WHERE
REGEXP_CONTAINS(DESCRIPTION, r"(>> )")
AND REGEXP_CONTAINS(desc, r"(hello.com)")
I believe I need to check if the line starts with >> and it contains hello.com in a single regex formula and then I can extract the 7 digit number after the /. I am stuck so
Any help would be much appreciated!!
(:?m)at the beginning of the regex to allow^to match both start of string and newline.