Regular expression to get number between two square brackets

前端 未结 6 1679
死守一世寂寞
死守一世寂寞 2021-01-27 14:19

Hi I need to get a string inside 2 pair of square brackets in javascript using regular expressions.

here is my string [[12]],23,asd

So far what I tr

6条回答
  •  温柔的废话
    2021-01-27 14:45

    Here is a regex you can use, capture groups to get $1 and $2 which will be 12 and 43 respectively

    \[\[(\d+)\]\]\S+\[\[(\d+)\]\]
    

提交回复
热议问题