url: http://xxxxxx.com/video/view/12345
Can I take 12345 in the url using javascript?
Please help me
url: http://xxxxxx.com/video/view/12345
Can I take 12345 in the url using javascript?
Please help me
Use RegExp, Array#match and negative lookahead.
var str = 'http://xxxxxx.com/video/view/12345';
console.log(str.match(/(?!view\/)\d+/)[0]);
window.location.href.split('/').pop() - also you assume there is a view always - the duplicate just takes the last