regex - Regular Expression for username -


I need help on regular expressions on the following condition (4):

  1. Start with A-z0-9 end with
  2. Allow as 3 special characters. _-
  3. Alphanumeric characters must be followed in letter (3), and it can not be followed by any character (3) in itself.

To ensure that how to do it

Try that:

  ^ [a-zA-Z] (([\ ._ \ -] [one-zA-Z0-9]) | [One-zA-Z0-9 ]] [One-Z0-9] $  

1) ^ [a-zA-Z]: beginning

2) (([._-] [A-zA-Z0-9]) | [A-zA-Z0- 9]): Any alphanumeric or special character since alphanumeric,

3) [a-z0- 9] $


Comments