Python 2.7.6 problem with applying re to a string in Russian.
the task is to find three alphanumeric characters followed by a dot;
code:
#!/usr/bin/python # -*- coding: utf-8 *-* import re new = re.findall("\w{3}\.", "gth. Ср. дек. 7 21:22:29 EET 2016" ) print newresult >>
['gth.']question: why is
'дек.'ignored ?
_?\wfinds underscores. And Alex’s answer is correct: in 2.7 you must usere.U/u"". - Wiktor Stribiżew[^\W_]- Wiktor Stribiżew