It is for a normal register name, could be 1-n characters with a-zA-Z and -, like
larry-cai, larrycai, larry-c-cai, l,
but - can’t be the first and end character, like
-larry, larry-
my thinking is like
^[a-zA-Z]+[a-zA-Z-]*[a-zA-Z]+$
but the length should be 2 if my regex
should be simple, but don’t how to do it
Will be nice if you can write it and pass http://tools.netshiftmedia.com/regexlibrary/
This should do it:
With this there need to be one or more alphabetic characters at the begin (
^[a-zA-Z]+). And if there is a-following, it needs to be followed by at least one alphabetic character (-[a-zA-Z]+). That pattern can be repeated arbitrary times until the end of the string is reached.