regexp

User avatar
Crisium
Level 7 - Spellcaster
Posts: 71
Joined: 13 Mar 2008, 17:57
Location: Odense C
Contact:

regexp

Unread post by Crisium » 30 Jul 2010, 11:51

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
kind regards,
Peter Wraae Marino

http://www.osghelp.com - support site for OpenSceneGraph

Christen
Level 13 - Portal opener
Posts: 138
Joined: 02 May 2008, 13:44
Location: København

Re: regexp

Unread post by Christen » 30 Jul 2010, 13:12

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]

Post Reply