[英]How to extract the data between the last two brackets in Postgresql?
So for example I have the following column:因此,例如我有以下列:
I need to have following column我需要有以下列
I am using this query to extract what's between columns:我正在使用此查询来提取列之间的内容:
select substring(Column FROM '\((BR.+)\)')
FROM Table
but obviously it only works if there is one pair of brackets in a field and not two.但显然它只有在一个字段中有一对括号而不是两个时才有效。
I am using Postgresql btw.我正在使用 Postgresql 顺便说一下。
Thanks谢谢
This always extracts the last parenthesized expression:这总是提取最后一个带括号的表达式:
substring(textcolumn FROM '\((BR[^)]+)\)[^(]*$')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.