XML : Regex cannot have a number in the first position or last and must be 8-20 characters long

Good Morning all. I have a regex that is not fulfilling what I need. I cannot start or end with a number. I must have at least one symbol, one upper case letter, one lower case letter and of course a number in between the outer "boundaries" I have described. The regex must be at least 6 characters long and 20 max. Below is my regex:

  ^([^0-9](?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[_!?@#$%])[^0-9]).{6,20}$    

The issue I am having is I cannot seem to get the number boundaries and length correct.

For example, in a regex tester this is acceptable,

  MaA1?kss1111111    

but is not acceptable to what I need.

But this would be acceptable,

  Mk?1wK    

I have no starting number and no ending number. I would appreciate any help.

No comments:

Post a Comment