I am trying to scan the C source code to detect the line of code then get the expressionA and expressionB in the form like this:
(*((_type*)expressionA)) = expressionB;
with the regex:
[*][(][\s]*[(\s]*.*[*][)\s]*(.*)\s*[)]\s*=(.*)[\s]*;
Here is the link with some test cases.
But this regex can not cover cases like this:
(*((volatile unsigned short*)(type01_01_06_base + (type01_01_06_offset * 1))) = (unsigned short)(unsigned long)0x01010101);
(*((volatile unsigned char*)add)) = (unsigned char)data;
Is there any solution to use regex to cover all cases in my problem?