2015-03-13 56 views

回答

0

我会分裂的 “:” 并使用11要素。

但是如果你必须使用正则表达式:

^(?:[^:]*:){10}:([^:]*) 

,并使用匹配的组1。

+0

谢谢波希米亚人。 – 2015-03-14 05:49:22

1

regexp_substr不关心捕获组,因此不包含在匹配中的字符是不可能的。从最终计数会的工作,虽然:

-- Returns the substring after the 6th ':' from the end. 
select regexp_substr(id, '([^:]*:){5}[^:]*$') from tempnew 
-- If the string does not contain 5 ':', an empty string is returned. 

如果你需要从一开始就来算,你可以使用regexp_replace代替:

-- Returns the substring after the 11th ':' 
select regexp_replace(id, '^([^:]*:){11}') from tempnew 
-- If the string does not contain 11 ':', the whole string is returned. 
+0

感谢Markus Jarderot ......我工作过。 – 2015-03-13 13:31:20

0

您可以使用split_part为了这个目的, 选择split_part(ID ,':',12)from tempnew