Regex to extract substring, returning 2 results for some reason

后端 未结 5 1375
情话喂你
情话喂你 2020-11-28 08:13

I need to do a lot of regex things in javascript but am having some issues with the syntax and I can\'t seem to find a definitive resource on this.. for some reason when I d

5条回答
  •  迷失自我
    2020-11-28 08:40

    I think your problem is that the match method is returning an array. The 0th item in the array is the original string, the 1st thru nth items correspond to the 1st through nth matched parenthesised items. Your "alert()" call is showing the entire array.

提交回复
热议问题