I have a requirement for an input field that should allow numbers, alphabets, and special characters like #
,$
,%
,^
etc. But with only one condition the first character that I enter in the text box should not be a special character.
Example:
- @Test123 --Invalid character
- Test@123 --Valid character
- T@est123% --Valid character
I tried this
ng-pattern="/^([a-zA-Z0-9]+)([a-zA-Z0-9 &()_+@&\-=\\|,.\/?\s]+)$/"
But not working.
Try this one
ng-pattern="/^[a-zA-Z0-9]+[^]*$/"
[a-zA-Z0-9]+
means one of alphabet or number and[^]*
means everything