How to validate a user name with regex?

后端 未结 10 1755
礼貌的吻别
礼貌的吻别 2020-11-27 12:34

This seems to match the rules I have defined, but I only starting learning regex tonight, so I am wondering if it is correct.

Rules:

  • Usernames can cons
10条回答
  •  北荒
    北荒 (楼主)
    2020-11-27 13:16

    I suggest writing some unit tests to put the Regex through it's paces. This will also help a few months from now when you find a problem with the Regex and need to update it.

提交回复
热议问题