the test variable is a YouTube link from which I am trying to extract pa14VNsdSYM
var test = "http://www.youtube.com/watch?feature=endscreen&NR=1&v=pa14VNsdSYM";
var urll = (test.search(/[?&;]v=([^&;]+)/) || [])[1];
document.write(''+urll+'');
but I am only getting undefined http://jsfiddle.net/ZGjDb/13/
Here’s the problem:
You should use
matchinstead ofsearch.Demo: http://jsfiddle.net/DerekL/ZGjDb/17/