對于此示例字串:“... Key Match extra text...”
如何獲取值“Match”,即“Key”后空格之間的字串?
有沒有比以下更好的方法:找到“鍵”的位置-> pos1,找到p1-> p2,子字串(字串,p1,p2)之后第一個空格的位置?
這不像我預期的那樣作業
Select substring('Key Match extra text', 'Key (. ) ');
---
Match extra
uj5u.com熱心網友回復:
您可以使正則運算式“非貪婪”,以便. 盡可能少地匹配:
Select substring('Key Match extra text', 'Key (. ?) ');
或者您可以更改.為不匹配空格的內容:
Select substring('Key Match extra text', 'Key (\S ) ');
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/341478.html
標籤:PostgreSQL
上一篇:無法使用CMD或入口點覆寫命令
