1

I have the following regular expression which allows only one special character in a string:

^[a-zA-Z0-9]*[\!\"\#\$\%\&\'\(\)\*\+\,\-\.\:\;\<\=\>\?\@\[\\\]\^\_\`\{\|\}\~][a-zA-Z0-9]*$

I'm trying to find out if I can add to the regular expression to test for a minimum length of eight characters as well. Something along the lines of:

^([a-zA-Z0-9]*[\!\"\#\$\%\&\'\(\)\*\+\,\-\.\:\;\<\=\>\?\@\[\\\]\^\_\`\{\|\}\~][a-zA-Z0-9]*){8,}$

Except, that doesn't work.

I know I can just check the length of the string in code, but I'd like to know how to do everything in one expression.

Thanks

crux
  • 21
  • 1

0 Answers0