Page 1 of 1

How to search for multiple semicolon on one line ?

Posted: Mon May 31, 2010 12:33 pm
by Sergeant999
Hello,

how I do search for a line wchich contains 2 or more semicolon ?

I want to find all C sourcrcode lines which contain more than one C command, for example:

a=0: b=0;
X=e+i ; u = 3/x ; Z=x*x;

Many thanks for any hint!

Regards
Sergeant999

Posted: Mon May 31, 2010 1:39 pm
by ben_josephs
;.*;

Posted: Tue Jun 01, 2010 2:34 pm
by MudGuard
this will also find some lines which only contain one C statement:

a = "x;y"; //only one statement
a = 1; //there's a ; at the end!

and it will also not find some lines which contain more than one statement:

if (x < 0) x = 2; //if statement and assignment statement

it is extremely difficult to have a correct result with a regex. There are so many special cases like Strings, characters, comments ...
Even with a full-featured regex engine it would be difficult, with Textpad's old engine it is probably impossible.

So I can't provide a better solution but still wanted to warn that the given solution has some shortcomings.