I'm using this Regex ^[a-zA-Z0-9]{2,20}$
to allow the followi开发者_如何学编程ng rules:
- Letters a-z
- Letters A-Z
- Numbers 0-9
- Input length must be at least 2 characters and maximum 20 characters.
I also want to allow apostrophe only at the end of words ending with s.
Thanks,
^([a-zA-Z0-9]{2,20}|[a-zA-Z0-9]{2,18}'s)$
So: either your original regex, or your original regex (reduced to maximum 18 characters, you might want to change the minimum as well) ending in "'s"
.
精彩评论