#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
Name = "_admin"
NUM_LETTER = re.compile("^(?!\d+$)[\da-zA-Z_]+$") #数字和字母组合,不允许纯数字
FIRST_LETTER = re.compile("^[a-zA-Z]") #只能以字母开头
def account_name_fomart(Name):
if NUM_LETTER.search(Name):
if FIRST_LETTER.search(Name):
return True
return False
def is_account_name_fomart(Name):
if not account_name_fomart(Name):
msg = "用户名不合法"
return msg
版权声明:本文为scissors0707原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。