Hope you all are doing well. I need a simple solution to my problem. I want to write a python code which takes C code as a string. Then regex like this r"#([^}]+)>|#([^}]+)\.h"
will detect the headers files part (From # include to '>' or '.h'). I also wanted to extract both group1 and group2 regex part. Then python code will extract and remove that header part of the C code and save it in 'any' variable. Then I want remaining code to be extracted as any other variable.
For example str1=
#include <iostream>
#include <string>
#include conio.h`
and str2=
void main (void)
{
int b = 32;
int a=34;
int wao= 35;
}
The input source code is:
#include <iostream>
#include <string>
#include conio.h
void main (void)
{
int b = 32;
int a=34;
int wao= 35;
}