PostgreSQL substring get string between brackets

后端 未结 2 1190
北恋
北恋 2021-01-17 12:12

I have a string, say:

Product Description [White]

I want to extract anything inside the brackets (in this case White) from that str

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-17 12:48

    (.) only matches a single character, but you want to match multiple characters in there.

    So you need (.+)

    substring('Product Description [White]' from '\[(.+)\]')
    

提交回复
热议问题