Javascript to find number after character (colon)

This question already has an answer here:

  • How do you access the matched groups in a JavaScript regular expression? 14 answers

  • Alex already gave you the answer: str.match(/number:s+(d+)$/i)[1] , which means the result at the index of 1. That index in the array is generated by the usage of the () in your regex. The first index (0) is the answer you've been getting.

    链接地址: http://www.djcxy.com/p/76794.html

    上一篇: JavaScript RegExp匹配组采用不需要的括号

    下一篇: Javascript查找字符后的数字(冒号)