def validCharacters(txt):
import re, unicodedata, locale
txt=txt.decode('utf-8')
locale.setlocale(locale.LC_ALL, 'ca_ES')
prog = re.compile("[-_àèìòùáéíóúñçÀÈÌÒÙÁÉÍÓÚÑÇ .a-zA-Z0-9]+$".decode('UTF-8'), re.L)
if not prog.match(txt):
return False
else:
return txt
评论列表
文章目录