Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi -

How do I create an ng-pattern to check input field for first two letters of input. I have a field that if user enters first two digits of 'MT' needs validation error. I know how to use reg ex patterns but not how to create my own.

What I have tried:

http://www.regular-expressions.info/javascriptexample.html
Posted
Updated 18-May-16 9:46am

1 solution

Do you just want to see if the field starts with "MT" ?
Then that regular expression is:
^MT
If you need something else, like to pull it apart in pieces, then please use "Improve question" to provide more details.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900