I need to find the following from c code using regular expression python but some how i could not write it properly.
if(condition)
/*~T*/
{
/*~T*/
_getmethis = FALSE;
/*~T*/
}
..........
/*~T*/
_findmethis = FALSE;
......
/*~T*/
_findthat = True;
I need to find all variables after /*~T/ starting with underscore and write to new file but my code could not find it i tried several regex pattern it is always empty output file
import re
fh = open('filename.c', "r")
output = open("output.txt", "w")
pattern = re.compile(r'(\/\*~T\*\/)(\s*?\n\s*)(_[aA-zZ]*)')
for line in fh:
for m in re.finditer(pattern, line):
output.write(m.group(3))
output.write("\n")
output.close()