Modifying my javaScript regex to accept forward slashes -


i took regex evaluating urls works nicely want use evaluate facebook accounts. example www.facebook.com/myname.

how regex doesn't forward slash after .com.

.directive('validatetheurl', function() {                 // hey chaps new ng 1.3 way custom validtae stuff.....                       var required_patterns = [/^(?:(ftp|http|https)?:\/\/)?(?:[\w-]+\.)+([a-z]|[a-z]|[0-9]){2,6}$/];          return {             require: 'ngmodel',             link: function ($scope, element, attrs, ngmodel) {                 ngmodel.$validators.theurl = function (value) {                     var status = true;                     angular.foreach(required_patterns, function (pattern) {                         status = status && pattern.test(value);                         console.log(status);                         console.log(value);                     });                     return status;                 };             }         }     }) 

does know how update regex?

simply append regex pattern accept forward slash after .com

[/^(?:(ftp|http|https)?:\/\/)?(?:[\w-]+\.)+([a-z]|[a-z]|[0-9]){2,6}\/[\w-]+$/]; 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -