Page 1 of 1

regexp

Posted: 30 Jul 2010, 11:51
by Crisium
hi all,

I would like to know if I can parse a text file using regexp and get the class name from a class that inherits from some other class. for example:

class whatever : public CMyThingy

I would like to have return "whatever" everytime it a class is derived from CMyThingy.

I'm not a regexp user.. but was thinking that it might be well suited for this?

any suggestions,
Peter Wraae Marino

PS: optimal version would return "whatever1, whatever2",.. if the file had two classes that derived from the CMyThingy

Re: regexp

Posted: 30 Jul 2010, 13:12
by Christen
Are you talking about regular expressions?

If you are you can do just that. A good tool to make your regEx is "regex coach". But regEx is different in different programming languages, so you might need to adjust it.

But it would go something like this:

Code: Select all

^class ([A-Za-z0-9]+) \: [public|private|protected]