I have been working with regular expressions for the past couple days in class. I cannot determine why this expression doesn’t work. I am looking for expressions like the following:
value = (struct node){ 5, NULL};
value2 = (structname){ 1, 2 };
*pointer = ( bla ){3,4};
Here is the expression I am using:
sed -n '/^[*0-9A-Za-z_]+ *= *( *[0-9A-Za-z_]+ *[0-9A-Za-z_]* *) *{[0-9A-Za-z, ]};/p' structfile
What am I missing because it returns nothing. Also a side note I have used [^,] in some expressions and I still get lines with , s. What am I missing?
You need to escape
+; and fix{[0-9A-Za-z, ]}to{[0-9A-Za-z, ]*}.