Regex Field Validation


Which is the correct way to create a regex of .net's ValidationExpression attribute for RegularExpressionValidator if I want to restrict the input of a textbox to "t-" + any 6 letters (no digits) i.e "t-jblogg"

t-[a-z]* but thats for t- followed by any letter/combination

This should work: ^t-\p{L}{6}$. This should accept any string which starts with t, is followed by a - and 6 letters. The \p{L} denote any letter from any language (as stated here). If you want to just restrict it to English letters then just use this: ^t-[A-Za-z]{6}$