I want to look for Structs in .C files and I'm using regex in c#
I have a Text like this:
typedef struct IsoSns_UxBuffer_tag
{
float32 f32Val[ISOSNS_UX_BUFFER_SIZE];
uint8 u8WrId;
float32 f32Val[ISOSNS_UX_BUFFER_SIZE];
struct IsoSns_UxBuffer_tag
{
float32 f32Val[ISOSNS_UX_BUFFER_SIZE];
uint8 u8WrId;
boolean bIsFull;
}IsoSns_UxBuffer_t;
}IsoSns_UxBuffer_t;
typedef struct IsoSns_UxBuffer_tag
{
float32 f32Val[ISOSNS_UX_BUFFER_SIZE];
uint8 u8WrId;
boolean bIsFull;
}IsoSns_UxBuffer_t;
my Regex is:
(?<Struct>(struct\s+\n*(?<strName>[a-zA-Z0-9_]*)\s*\n*{[\s\n]*((?R)*|(?<Element>([a-zA-Z0-9_\s\]\[]*\n*;[\s\n]*))*)*[\n\s]*}\s*\n*(?<Alias>[a-zA-Z0-9_\[\]]*)\s*\n*;))
It works fine, but .net doesn't support recursive arguments like "?R".. I've read that I can solve this Problem by using balancing Groups. But I can't figure out how...
Is there maybe a better way to look for nested structs in c files by using regex?