re module - error with non-greedy matches
Derek Thomson
derekt at dstc.qut.edu.au
Thu Jan 10 01:43:43 EST 2002
Hi Paul,
Paul Wright wrote:
> In article <3C3C4FFA.1040104 at dstc.qut.edu.au>,
> Derek Thomson <derekt at dstc.qut.edu.au> wrote:
>
>>I'm having some trouble porting a Perl program to Python. It extracts C
>>functions from the source and performs some analysis.
>>
>
> This is peripherally related to your question, but: when I'm doing
> analysis of C, I usually connect Python to Exuberent Ctags
> <http://ctags.sf.net/> via a pipe, rather than trying to parse C with
> regexps.
No, I wouldn't try parsing C with regexes. The above is pretty much all
the parsing needed.
> (Actually, I usually get ctags to do the hard stuff and then do
> the easy stuff in Python with regexps). I'd recommend this method as a
> workaround. ctags -x is a useful option, as it produces nicely
> delimited output.
I'm sure this works, but I really need to know that Python regexes
aren't broken before I can seriously use Python for all my scripting
needs. I use it for some things (CORBA, GUIs, Java/C/C++ scripting) but
I'd like to try it as a drop-in replacement for Perl. Yes, I realize
that some things are done differently in different languages, but the re
module documentation clearly states that non-greedy matching is
supported, and it's something I do need on the odd occasion.
Thanks anyway for the help!
Regards,
Derek.
More information about the Python-list
mailing list