var clientid = (window.location.search.match(/[?&;]name=(\d+)/) || [])[1];
If it can contain more numbers, use something like ...
var clientid = (window.location.search.match(/[?&;]name=([^&;]+)/) || [])[1];
If the parameter is not found, it will return undefined.
If you need to do this more often, you will be better off with a common solution .
source
share