only utf-8 letters regex pattern

151 views
Skip to first unread message

armagan

unread,
Jan 16, 2013, 4:44:44 AM1/16/13
to django...@googlegroups.com
Hi,

I'm trying to use regex patterns in django form. I successed in only letters regex pattern. But form controler declines Turkish chars. I think I must use utf-8 regex. Can you help me?

name = forms.RegexField(regex =r'^[a-zA-Z]+$')

Thanks for help.

Jian Chang

unread,
Jan 16, 2013, 5:16:43 AM1/16/13
to django...@googlegroups.com
you can use unicode.

2013/1/16 armagan <armaga...@gmail.com>
Turkish chars


Adam Mesha

unread,
Jan 16, 2013, 4:37:10 PM1/16/13
to django...@googlegroups.com
You can explicitly add the Turkish characters to the character class if there are just a few of them. You could also use the UNICODE regex flag and do something like ur'(?u)^[^\W\d_]+$', which will match any string consisting solely of alphabetic unicode characters.

2013/1/16 armagan <armaga...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/n_RDevJyBMgJ.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.



--
Adam Mesha <adam....@gmail.com>
Life is either a daring adventure, or nothing. - Helen Keller
Reply all
Reply to author
Forward
0 new messages