How can I extract the string \"XMLFileName\" from the below URL using regular expression
var x = \"C:\\Documents and Settings\\Dig\\Desktop\\XMLFileName.xm
You could do it with split(), pop() and replace()...
split()
pop()
replace()
var filename = x.split('\\').pop().replace(/\..+$/, '');
jsFiddle.
You could also use a single regex...
var filename = x.replace(/.*\\|\..*$/g, '');
Ensure you escape the \ in your string literal too.
\