var a = "url('foo.jpg')";
alert( a.replace( /url\(["']?(.*?)["']?\)/, '$1' ) );
var a = "url(\"foo.jpg\")";
alert( a.replace( /url\(["']?(.*?)["']?\)/, '$1' ) );
var a = "url(foo.jpg)";
alert( a.replace( /url\(["']?(.*?)["']?\)/, '$1' ) );
var a = "foo.jpg";
alert( a.replace( /url\(["']?(.*?)["']?\)/, '$1' ) );