2017-09-26 37 views

回答

1

,如果你想使用substring with regular,采取星号方括号:

t=# SELECT substring('QUITAR1 *W01 - 123456/9* QUITAR2 ' from '%#"[*]%[*]#"%' for '#'); 
    substring 
------------------ 
*W01 - 123456/9* 
(1 row) 

所以得到你想要的:

t=# SELECT replace(substring('QUITAR1 *W01 - 123456/9* QUITAR2 ' from '%#"[*]%[*]#"%' for '#'),'*',''); 
    replace 
---------------- 
W01 - 123456/9 
(1 row) 

我正在使用替换,因为在文本中有asterix可能无论如何会制动屏蔽

相关问题