【问题标题】:Big Query SQL regex for a field ending with a 7 digit number以 7 位数字结尾的字段的 Big Query SQL 正则表达式
【发布时间】:2025-12-05 14:55:02
【问题描述】:

在我的查询中,我试图过滤 pagePath 以仅包含以七位数字结尾的 pagePath 值。我怎样才能做到这一点?

SELECT pagePath
FROM table
where pagePath (ends with a 7 digit number)

【问题讨论】:

标签: sql regex google-bigquery where-clause


【解决方案1】:

只是:

where regexp_contains(pagePath, '\d{7}$')

正则表达式解释:

\d     a digit (0 to 9)
{7}    quantifier (hence we want 7 occurences of a digit)
$      end of the string

【讨论】: