in reply to case insensitive replace, but maintains capitalization

Regular expressions are patterns that can be matched. They don't do anything, much less replace anything. You could use the substitution operator. It uses a regular expression to determine what to replace.
s/cat Cat/dog Dog/

Replies are listed 'Best First'.
Re^2: case insensitive replace, but maintains capitalization
by Anonymous Monk on Dec 24, 2010 at 04:37 UTC
    Sorry, I should be more specific, I need a generic reg exp taht can handle all words. The 'cat' word is just an example, it could be anything else.

      You're in luck, /\w+/ is a regular expression that can handle all words!

      ...roboticus

      Mr. Tautology

      </snark-mode>

      so use \w+