I'm trying to parse a c source file, and find all functions that match the following template:
umsg_xxxxx_yyyy_zzz(aaa,bbb,ccc,ddd)
examples:
umsg_test_uints_subscribe(1,1)
umsg_sensors_imu_receive(sub,&msg,portMAX_DELAY)
umsg_sensors_imu_publish(&imu_data);
umsg_sensors_imu_peek(&peek_msg);
I've tried something like this:
f = open(file)
print(file)
# find words starting with umsg_ and ending with )
for line in f:
if re.search(r'umsg_[a-z]+\(.*\)', line):
print(line)
But it fails to find anything.
Could anyone help me figure out the regex expression?
Thanks!