Re: [Tutor] the regex boundary about chinese word

2012-05-04 Thread Peter Otten
goog cheng wrote: > Hi, I got this problem : > > #!python > # -*- coding: utf-8 -*- > import re > > p = re.compile(ur'\bc123\b') > print '**',p.search('no class c123 at all').group() > > p = re.compile(ur'\b\u7a0b\u6770\b') > print ur'\u7a0b\u6770' > print '',p.search(' 程杰 abc'.decode('utf

[Tutor] the regex boundary about chinese word

2012-05-03 Thread goog cheng
Hi, I got this problem : #!python # -*- coding: utf-8 -*- import re p = re.compile(ur'\bc123\b') print '**',p.search('no class c123 at all').group() p = re.compile(ur'\b\u7a0b\u6770\b') print ur'\u7a0b\u6770' print '',p.search(' 程杰 abc'.decode('utf8')) why the \b boundary can't match t