I am trying to catch unions and structures with regular expressions. The full match will catch the whole structure and group1 will catch the members.
struct Name
{
uint16 member1;
uint16 member2;
};
union Name
{
uint16 member1;
uint16 member2;
};
When trying to find a specific union it works as expected with:
r"union Name[\s\S]*{\s*([\s\S]*)};"
but when trying to find a specific struct I use the regular expression:
r"struct Name[\s\S]*{\s*([\s\S]*)};"
which is identical except that union is replaced by struct. The regular expression for catching the struct just continues matching all the lines following the structure and I do not understand why, because it does not for the union case and I do not understand why?