Regular expressions for accents like ó character in python
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Thu Jun 19 01:52:19 EDT 2008
En Thu, 19 Jun 2008 02:08:38 -0300, Sallu <praveen.sunsetpoint at gmail.com>
escribió:
> i want to restrict to user to not enter accents character. si i need
> to make an Regular expressions for accents like ó character
You may enumerate all the allowed characters:
py> allowed_re = re.compile(r"^[A-Za-z0-9 ]*$")
py> input = "hello world"
py> allowed_re.match(input)
<_sre.SRE_Match object at 0x00A3C1E0>
py> input = "código inválido"
py> allowed_re.match(input)
py> print allowed_re.match(input)
None
--
Gabriel Genellina
More information about the Python-list
mailing list