Created
May 15, 2014 18:01
-
-
Save haohcraft/4713d0cee2431007b15c to your computer and use it in GitHub Desktop.
This file contains 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
var urlRegEx = /(http|https|ftp):\/\/[-a-zA-Z0-9@:%_\+.~#?&\/\/=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?$&\/\/=]*)?/gi; | |
//If entered data doesn't match the URL regex, then return error data, and don't actually make the AJAX request. | |
if (!urlRegEx.test(link)) { | |
var badURL = {warning: "Snap! That link came back with nothing. How about pasting it in?", tags: []}; | |
$scope.suggestedData = badURL; | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment