Last active
April 8, 2020 03:12
-
-
Save kangmasjuqi/f84f4662df0a67f6b9df3ed2f4f2d1c7 to your computer and use it in GitHub Desktop.
Javascript Regex - check valid file URL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REGEX : | |
/(www\.|https?:\/\/)([a-z0-9_\-\.])+([a-z])+\/([a-z0-9_\-\.\/])*([a-z0-9_-])+\.(aif|aiff|bmp|cr2|crdow|db|doc|docx|ds_st|exr|flv|jpeg|jpg|m2ts|m4a|m4v|mkv|mov|mp3|mp4|mpeg|mpg|mxf|pdf|png|psd|rar|rtf|tga|tif|tiff|vid|wav|webm|wma|wmv|xlsx|xml|zip)/gmi | |
LINK : | |
https://regex101.com/r/NjaPbb/1 | |
TEST CASES : | |
https://www.tutorialspoint.com/How-to-validate-URL-address-in-JavaScript | |
https://s3.amazonaws.com/myannies.production.materials/emdjmAsBTZCokvObL5QS_asf-sidebar.png?AWSAccessKeyId=AKIAJ2QHM35O6JEFKLJA&Expires=1586349352&Signature=GKrtIO4fbH3eLEV8J6g0Rb6p64g%3D | |
https://kangmasjuqi.files.wordpress.com/2020/03/app-goto-1000.png | |
http://kangmasjuqi.files.wordpress.com/2020/03/app-goto-1000.png | |
http://kangmasjuqi.files.wordpress.com/2020/03/app-goto-1000 | |
http://kangmasjuqi.files.wordpress.com/2020/03/app-goto-1000.png | |
http://kangmasjuqi.files.wordpress.com/2020/03/app-goto-1000.jpg | |
http://kangmasjuqi.files.wordpress.com/2020/03/app-goto-1000.JPG | |
www.test.com/a.PDF | |
www.kangmasjuqi.files.wordpress.com/2020/03/app-goto-1000.JPG | |
http://test.wordpress.com/2020/03/app-goto-1000.png | |
www.oraumum.net/a.PDF | |
http://oraumum.net/a.PDF?askldhajkd=ajdha_asd92 | |
https://kangmasjuqi.files.wordpress.com/2020/03/app-goto-1000.png?w=326&h=277 | |
https://www.tutorialspoint.com/images/QAicon.png | |
https://stackoverflow.com/questions/5717093/check-if-a-javascript-string-is-a-url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment