Check whether the image type is displayed

    // Verify that it is a picture
    IsImg(file){
        // let reg=/(.*)\\.(jpg|bmp|gif|ico|pcx|jpeg|tif|png|raw|tga|PNG|JPG|JPEG)$/;
        let reg=/\.(jpg|gif|jpeg|PNG|JPG|JPEG)+$/ 
        return reg.test(file)
    // console.log(' verify if it is a picture ',reg.test(file))
    }

Copy the code

Exec, match, test, and other functions that use regular expressions