newbie re question

Gonçalo Rodrigues op73418 at mail.telepac.pt
Wed Nov 6 16:55:05 EST 2002


On Wed, 6 Nov 2002 22:40:20 +0100, "Noel Minet" <noel.minet at noos.fr>
wrote:

>It seems ':' and '@' are considered as a word breaks
>Also, it seems the OP wants to capture 'a.aa'
>
>a lookahead does it:
>
>>>> pattern = re.compile(r'(?:\s|^)([\w_][\w\._]*)(?=\s|$)')
>>>> pattern.findall('aadf cdase b ad:aa aasa a.aa a@ aa _aa _aafr@ aa_aa
>aa__a?jk xxx')
>['aadf', 'cdase', 'b', 'aasa', 'a.aa', 'aa', '_aa', 'aa_aa', 'xxx']
>
>

Thanks! This does the job! Now let me see If I can understand how it
works...

With my best regards,
G. Rodrigues



More information about the Python-list mailing list