I'd like to search for all the compilation flags in an expression such as:
-Xaa=2000 -tbb:simple -Xcc-dds -g -c -DC_hh -Xii-ff-file -Xmm-nn -Xkk -o output/gg.o -ee1481 -Xll=0x1000 -I. -I./ss/tt/uu -I./ss/tt/ww -I./EIS_CFG/gentool/make -I./testenv
Using rexex, so that each flag is in its own group. I have come as far as:
(?<= -)(.*?)(?= \-)
which I found in the answers to this question , and it finds everything except the last flag, as it requires each group to have a ' -' after it. How can I also get hold of the last flag?
Edit after I accepted the answer:
Is it possible to include the '-' inside the group?
Also, if the pattern contains a .c / .cpp file to compile, is it possible to remove it?
For example in:
-Xaa=2000 -tbb:simple -Xcc-dds -g -c -DC_hh -Xii-ff-file -Xmm-nn -Xkk -o output/gg.o -ee1481 -Xll=0x1000 -I. ./ff/gg/vv.c -I./ss/tt/uu -I./ss/tt/ww -I./EIS_CFG/gentool/make -I./testenv
Get all groups without the ./ff/gg/vv.c