RegEx to extract all matches from string using RegExp.exec

前端 未结 17 1190
-上瘾入骨i
-上瘾入骨i 2020-11-22 02:49

I\'m trying to parse the following kind of string:

[key:\"val\" key2:\"val2\"]

where there are arbitrary key:\"val\" pairs inside. I want t

17条回答
  •  被撕碎了的回忆
    2020-11-22 03:09

    Use this...

    var all_matches = your_string.match(re);
    console.log(all_matches)
    

    It will return an array of all matches...That would work just fine.... But remember it won't take groups in account..It will just return the full matches...

提交回复
热议问题