Page 1 of 1

replacement of C-identifiers

Posted: Mon Jan 31, 2005 5:32 pm
by Friedrich
Hi,

I tried to "batch replace" all C-identifiers named "xy" by "ab" using the following reg.exp. for the find:
\Wxy\W
For the replacement I used:
ab
Obviously, the non-alphanum character before "xy" and the non-alphanum char after "xy" get removed during this process: The C-file is no longer compilable. But I need such to check for \W because there exist C-identifiers "xyz" which should not be touched.

Any suggestions?

Additionally: how can I tell the "batch replace" to ignore all entries found in C-comments (both multi-line /*...*/ and single line //) ?

Thanks alot,

Friedrich

Posted: Mon Jan 31, 2005 5:32 pm
by Abacre
> Any suggestions?
That's easy.

Search for:
(\W)xy(\W)

Replace with:
$1ab$2

>
> Additionally: how can I tell the "batch replace" to ignore all
> entries found in C-comments (both multi-line /*...*/ and single line
> //) ?
>
What do you mean ignore? Do you want to remove all comments?
Or do you what replace all "xy" by "ab" in code but not in comments?