Extracts all substrings that match the regular expression and returns them as an array.
ARRAY<STRING>Diperbarui: 13 Jun 2026REGEXP_EXTRACT_ALL(value, regexp)The source string
Regular expression pattern
1 SELECT 2 text, 3 REGEXP_EXTRACT_ALL(text, r'[0-9]+') as numbers 4 FROM `project.dataset.logs`;
Extract all numbers from a text string.
| text | numbers |
|---|---|
| Order #123 Item #456 | ["123", "456"] |
| No numbers here | [] |
1 SELECT 2 tweet, 3 REGEXP_EXTRACT_ALL(tweet, r'#(\w+)') as hashtags 4 FROM `project.dataset.tweets`;
Extract all hashtags without the # symbol.
| tweet | hashtags |
|---|---|
| #BigQuery is #awesome! | ["BigQuery", "awesome"] |
1 SELECT 2 id, 3 hashtag 4 FROM `project.dataset.tweets`, 5 UNNEST(REGEXP_EXTRACT_ALL(tweet, r'#(\w+)')) as hashtag;
Expand the extracted array into individual rows.
Sudah paham REGEXP_EXTRACT_ALL? Latih langsung di browser
Latihan interaktif, langsung di browser.