# Extract all pattern occurrences in BigQuery

If you ever need to extract information based on a pattern in a BigQuery string, check out the `REGEXP_EXTRACT_ALL` function.

This will return an array of all the occurrences matching the specified regular expression.

With regards to the pattern itself, I typically use a representative example with a regex debugger like [regex101](https://regex101.com/).

Worth noting that it has a limitation - it would only work with a single regex capture group, so you can't match multiple patterns at the same time.

![](https://miro.medium.com/v2/resize:fit:1400/0*Fxorjdvu_k44mtja align="left")

*Found it useful? Check out to my Analytics newsletter at* [*notjustsql.com*](https://www.notjustsql.com)*.*
