同时使用捕获组和非捕获组:
regexp_extract(${column},'^((?:AG|TS).*)')
解释
--------------------------------------------------------------------------------
^ the beginning of the string
--------------------------------------------------------------------------------
( group and capture to \1:
--------------------------------------------------------------------------------
(?: group, but do not capture:
--------------------------------------------------------------------------------
AG 'AG'
--------------------------------------------------------------------------------
| OR
--------------------------------------------------------------------------------
TS 'TS'
--------------------------------------------------------------------------------
) end of grouping
--------------------------------------------------------------------------------
.* any character except \n (0 or more times
(matching the most amount possible))
--------------------------------------------------------------------------------
) end of \1