Alex Rivera | Logout

How to get a number out of this url in javascript regex

Asked 2011-09-07T08:53:19.570
10

I have this url

http://nikerunning.nike.com/nikeplus/v2/services/app/run_list.jsp?userID=1413795052&startIndex=0&endIndex=-1&filterBy=all

I want to fetch 1413795052 number using regex in javascript, how can I achieve this?

Edit
Report

1 Answer

2

Try with:

var input = "http://nikerunning.nike.com/nikeplus/v2/services/app/run_list.jsp?userID=1413795052&startIndex=0&endIndex=-1&filterBy=all";

var id = parseInt( input.match(/userID=(\d+)/)[1] );
answered 2011-09-07T08:56:54.523

Your Answer