regular expression - function body extracting

Posted by Altariste on Stack Overflow See other posts from Stack Overflow or by Altariste
Published on 2010-06-15T10:48:52Z Indexed on 2010/06/15 10:52 UTC
Read the original article Hit count: 146

Filed under:
|

Hi,

In Python script,for every method definition in some C++ code of the form:

return_value ClassName::MethodName(args) {MehodBody}

,I need to extract three parts: the class name, the method name and the method body for further processing. Finding and extracting the ClassName and MethodName is easy, but is there any simple way to extract the body of the method? With all possible '{' and '}' inside it? Or are regexes unsuitable for such task?

© Stack Overflow or respective owner

Related posts about python

Related posts about regex