replacement of C-identifiers

General discussions about Advanced Find and Replace
Post Reply
Friedrich

replacement of C-identifiers

Post by Friedrich » Mon Jan 31, 2005 5:32 pm

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

Abacre
Site Admin
Posts: 1201
Joined: Mon Jan 31, 2005 5:32 pm
Contact:

Post by Abacre » Mon Jan 31, 2005 5:32 pm

> 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?

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests