Page 1 of 1

RegEx: Exclude comments on seaching ?

Posted: Thu Sep 18, 2003 9:58 pm
by sergeant
Hello,

may I ask the experts for help on following RegEx problem:

I want to search something in a C++ file, but all comment
lines should be ignored while searching.

Code: Select all

//Test.c
   /* Test progam */
void main(void)
{
  int iTest;
  ...  
Searching this code for Test should only found the line int iTest;
The starting chars // or /* of the comment may start at pos. 1,2
but it's also possible that they are preceded by spaces and/or
tabs.

Any idea, how to achive this?

Thanks for any hint!

Regards
Juergen

Posted: Thu Sep 18, 2003 11:05 pm
by s_reynisson
I think your problem might fall under the "line containing one word but not the other" problem... to which we found no solution.
Of course I still hope to be proven wrong :wink:
Good luck!