I'm using this regex in Python:
import re
>>> ER = re.compile('^\w{0,30}$', re.U)
>>> ER.sub('.', 'Maçã')
>>>....
But a wanna catch only letters, [A-Z] does not wo开发者_如何学Gork for me, because i need letters with accent . Is there any way to use POSIX? [:alpha:], something like that or another solution?
Thanks!
Modified the regex - how about
ER = re.compile(u'^[^\W\d_]{1,30}$', re.U)
s = ER.sub(u'.', u'Maçã')
matches u'Maçã' but not u'Maçã01'.
精彩评论