I'm trying to get only the name of the selected file using this regex :
var regex = /.*(\/|\\)/;
but it only works in some cases, you can find the full example in this fiddle :
var regex = /.*(\/|\\)/;
var path1 = 'C:\fakepath\filename.doc'.replace(regex, ''),
path2 = 'C:\\fakepath\\filename.doc'.replace(regex, ''),
path3 = '/var/fakepath/filename.doc'.replace(regex, '');
How can solve this ?