RegEx: Exclude comments on seaching ?

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
sergeant
Posts: 7
Joined: Thu Sep 18, 2003 9:42 pm

RegEx: Exclude comments on seaching ?

Post 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
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post 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!
Post Reply