如何在单个句号之间提取所有文本(即忽略...)使用re2正则表达式?
我正在使用REGEXP_EXTRACT_ALLBigQuery中的函数,该函数使用
https://github.com/google/re2/wiki/Syntax.。
来自以下示例:
This is... a.. sentence. It is just an example.
我想要提取查询
This is... a.. sentence.和 It is just an example.
我特别感兴趣的是,是否可以在BigQuery中使用SQL函数而不是引入其他工具。
发布于 2021-02-25 06:01:06
考虑以下解决方法
select text, regexp_replace(sentence, r'(#)(\.+)(#)', r'\2') sentence
from `project.dataset.table`,
unnest(split(trim(regexp_replace(regexp_replace(text, r'(\.+)', r'#\1#'), r'(\#\.\#)', r'####'), '####'), '####')) sentence如果应用于问题中的样本数据,则输出为

https://stackoverflow.com/questions/66356610
复制相似问题