re module

Mathieu Malaterre mathieu.malaterre at creatis.insa-lyon.fr
Wed Jun 11 11:32:51 EDT 2003


Hi all,

    I am having some troubles with the 're' module. Here is the text I
would like to parse:

"A button is a control that contains a text string,
and is one of the commonest elements of a GUI. It may be placed on a
\helpref{dialog box}{wxdialog} or \helpref{panel}{wxpanel}, or indeed
almost any other window."

Thus I construct a pattern:

patt = re.compile('(?P<gar1>.*?)\\\\helpref{?(?P<name1>.*?)}{?(?P<name2>.*?)}(?P<gar2>.*?)',
re.DOTALL)

but after a findall() I only get:

[('\nA button is a control that contains a text string,\nand is one of
the
commonest elements of a GUI. It may be placed on a\n ', 'dialog box',
'wxdialog', ''), (' or ', 'panel', 'wxpanel', '')]
            ^^                                ^^ 

Where has gone: ', or indeed almost any other window.' ?

Could someone told me what I am doing wrong ?

Thanks a lot,
mathieu




More information about the Python-list mailing list