Here are my requirements:
- 1-80 characters
- These characters are allowed:
- alphanumeric
- spaces
_ ( ) [ ] ! # , . & * + : ' / -
The regex I have below works, but in particular I’m not sure how to reuse the character class [\w\(\)\.\-\[\]!#,&*+:'\/]
[\w\(\)\.\-\[\]!#,&*+:'\/][\w\s\(\)\.\-\[\]!#,&*+:'\/]{0,79}
Update:
Thanks for all your answers, this one did the trick
^(?!\s)[\w\s().\-!#&]{1,80}$
If the first character can’t be white space try this:
(?!\s)[-\w\s().[\]\\!#,&*+:'/]{1,80}. You may want to “bracket” with ^ in the beginning and $ at the end^(?!\s)[-\w\s().[\]\\!#,&*+:'/]{1,80}$, to have the regex match the whole string.