雪花是否支持正则表达式中的正后视?

Does snowflake support positive lookbehind in a regex?

我想在我的 regexp_substr 表达中使用积极的回顾。

我有以下内容:

regexp_substr(My_Data, '(?<=id:).*(?=;)', 1, 1)

这给了我以下错误:

Invalid regular expression: '(?<=id:).*(?=;)', no argument for repetition operator: ?

我正在尝试拆分我有

的键值对

id:1234;

Snowflake 的正则表达式不支持后视。

但是,您可以使用常规正则表达式组来实现您想要实现的目标:

select regexp_substr('Something,id=12345;Somethng', 'id=([^;]+);',1, 1, 'e');
-----------------------------------------------------------------------+
 REGEXP_SUBSTR('SOMETHING,ID=12345;SOMETHNG', 'ID=([^;]+);',1, 1, 'E') |
-----------------------------------------------------------------------+
 12345                                                                 |
-----------------------------------------------------------------------+

注意提取的 'e' 参数,请参阅 the documentation