problem description
for example, I have an array ["mai.jpg","da.png","xiao.gif"],
how can I write rules to match these images, so that pictures that are not in jpg,png,gif format cannot be uploaded!
the environmental background of the problems and what methods you have tried
function isImage (str) {
var reg = / w (.png | .jpg | .gif | .bmp | .psd | .tiff | .tga | .eps) / I;
return str.match (reg);
}
this seems to have no effect. Please let me know
related codes
/ / Please paste the code text below (do not replace the code with pictures)