i have been trying with this for a while and failing, not that good with regex, what i need is the following:
A user name (the name of the person not a username)
it can include - because some names have hyphen in them (max of 2 allowed)
it can include a space (up to 3)
it cannot include numbers and must start with a letter not a hyphen
it must be at least 3 chars and 30 max
it must accommodate to people with non English letters (e.g. Agnès)
I tried this but it failed, it allowed starting with a number and did not accept non English letters like è or ï
^[a-zA-Z\-]{3,30}$
Any help would be highly appreciated and I think this will help many programmers searching SO
[a-zA-Z-]but\D(or the equivalent[^0-9])XRegExpor build a custom Unicode letter class.^(?!(?:[^ ]* ){4})(?!(?:[^-]*-){3})\p{L}[\p{L} -]{2,29}$.