^(?=.{8,20}$)(?![_.])(?!.*[_.]{2})[a-zA-Z0-9._]+(?<![_.])$ └─────┬────┘└───┬──┘└─────┬─────┘└─────┬─────┘ └───┬───┘ │ │ │ │no _ or . at the end │ │ │ │ │ │ │ allowed characters │ │ │ │ │ no __ or _. or ._ or .. inside │ │ │ no _ or . at the beginning │ username is 8-20 characters long如果您的浏览器由于缺乏负面的后向支持而引发错误,请使用以下替代模式:
^(?=[a-zA-Z0-9._]{8,20}$)(?!.*[_.]{2})[^_.].*[^_.]$


