Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个具有如下值的数据集:
我想提取字符串的起始部分,在空格之前或 _ 之前
所以在 LookML 中,我写道: sql: split(regexp_extract(${column},'^AG.*'),' ')[safe_offset(0)]这行得通,但只有在分隔符是空格时才会提取。
sql: split(regexp_extract(${column},'^AG.*'),' ')[safe_offset(0)]
如果分隔符是 _ AND 空格,我该如何提取值?
您可以使用
^(AG[^ _]*)
请参阅此正则表达式演示。
详情:
^
(AG[^ _]*)
AG
[^ _]*