JSFiddle - React, Tailwind, and code Playground
JavaScript
var strFile = "testing.mp3";
if (strFile.match("^[a-zA-Z0-9-_\.]+\.(swf|mov|wma|mpg|mp3|wav)$")){
alert('yes');
}else{
alert('no');
}
var strFile = "testing.mp3";
if (strFile.match("^[a-zA-Z0-9-_\.]+\.(swf|mov|wma|mpg|mp3|wav)$")){
alert('yes');
}else{
alert('no');
}