Regex to get return the first two ints
Given a string like: #/projects/58/tasks/140
I want to be able to extract 58 & 140.
I have the following:
parseInt(hash.match(/\d+/开发者_JAVA百科)[0]);
This gets 58, but I can't get 140 with:
parseInt(hash.match(/\d+/)[1])
y? thanks
Use "g" modifier
hash.match(/\d+/g)
精彩评论