new to regex, is there a way to determine files having no extension?
Also need another one for .zip files
(//).test(files[i])
new to regex, is there a way to determine files having no extension?
Also need another one for .zip files
(//).test(files[i])
The best way to get extentions I've found is from: How can I get file extensions with JavaScript?. This isn't regex, but you don't need regex - so unless this is a learning exercise, I'd go with string-based functions.
With that in hand you can check for blank as:
if(filename.substr((~-filename.lastIndexOf(".") >>> 0) + 2).length==0)
and for zips as:
if(filename.substr((~-filename.lastIndexOf(".") >>> 0) + 2)=="zip")
Check out that other post, if you definitely want regex - there are a couple good ones in there.