I'm trying to math all class references in a C++ file using grep with regular expression. I'm trying to know if a specific include is usuless or not, so I have to know if there is a refence in cpp.
I wrote this RE that searches for a reference from class ABCZ, but unfortunately it isn't working as I espected:
grep -E '^[^(\/\*)(\/\/)].*[^a-zA-Z]ABCZ[]*[\*\(\<:;,{& ]'
[1] don't math comments in the begging of the line ( // or /* )
.* followed by any character
[^a-zA-Z] do not accept any caracter before the one I'm searching (like defABCZ)
* any white space (I can have something like ABCZ var; )
[\*\(\<:;,{& ] followed by ( * < : ; , & { (I cant get #define "ABCZ.h" or ABCZdef for example)
Well, I can get patterns like this:
That's all right, they are all acceptable patterns. But these I'm missing, and they are all acceptable too:
And all these are not acceptable:
#include "ABCZ.h"
//ABCZ var = ABCZ();
ABCZdef a = ABCZdef();
DefABCZ a = DefABCZ();
ABCZdef a = ABCZdef();
/*ABCZ var = ABCZ();
I don't know if I'm missing any other patterns, if I am, please tell me =p
What am I doing wrong?
I'll be very grateful if someone answer me
Thanks in advance
^(\/\*)(\/\/) ↩︎