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