How to remove square brackets and anything between them with a regex?

前端 未结 3 1972
野的像风
野的像风 2020-11-28 11:39

How can I remove text from between square brackets and the brackets themselves?

For example, I need:

hello [quote=\"im sneaky\"] world
3条回答
  •  猫巷女王i
    2020-11-28 12:27

    I think you actually want parens for your outer brackets since it's a group. square brackets are a range of expressions. Not sure how to type it in SO.

    /(\\[.*\\])/
    

提交回复
热议问题