I have some missunderstanding with encoding regexp:
>>> simplejson.dumps({'title':r'\d+'})
'{"title": "\\\\d+"}'
>>> simplejson.loads('{"title": "\\\\d+"}')
{u'title': u'\\d+'}
>>> print simplejson.loads('{"title": "\\\\d+"}')['title']
\d+
So, without using print I see \\, with using print I see \. So, what the value loaded dict contains – with \\ or with \?
Here is a trick: Use
listto see what characters are really in the string:listbreaks up the string into individual characters. Sou'\\'is one character. (The double backslash inu'\\'is an escape sequence.) It represents one backslash character. This is correct sincer'\d+'also has only one backslash: