Regular Expression for SFTP URL

Wilson

In my application i am using angularjs and html5. The requirement is to get only sftp sites as URL. The default URL attribute of html5 allows http,https,sftp and ftp sites. I think using ng-pattern will solve this issue. But i am not sure about the pattern to be used. Can anyone help on this.

<input type="url" name="url" ng-model="user.url" required ng-pattern="sftp://.+"/>
 <span class="error" ng-show="myForm.url.$error.pattern">URL is in Invalid Format
  </span>

The error message for invalid url is not at all displaying.

sms

The Pattern is correct. Just use ng-pattern="/sftp://.+/". The // will make the difference. The ng-pattern will accept parameters given within /../ braces.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related