Do it like this:
s/\b([Cc])at\b/<span class="topic">${1}at</a>
By catching the "c" (be it "C" or "c") in $1 and using it in the substitution, you're preserving it's case.
Adjust to fit your particular need :-)
In reply to Re: case preservation in regexp
by cog
in thread case preservation in regexp
by water
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |