My question is pretty straightforward, using only a regular expression find and replace, is it possible to keep the case of the original words.
So if I have the string: "Pretty pretty is so pretty" How can I turn it into: "Lovely lovely is so lovely"
All I have so far is find /(P|p)retty/g
and replace with $1ovely
but I dont know how to replace caplital P with L and lowercase p with l.
I am not interested in accomplishing this in any particular language, I want to know if it is possible to do with pure regex.