title: How to find and replace items not preceded or followed by specific characters with sed?
body: <p>How can I restrict find and replace to replace items, but not if the character immediately before it is "A", "B", or "C" or the character immediately after it is "X", "Y", or "Z". E.g. given these input lines, if "cat" is to be replaced with replaced with "pet":</p>
  
  <ul>
  <li>"There is a cat." → "These is a pet."</li>
  <li>"There is Acat." is unchanged, because "A' is found before.</li>
  <li>"There is catY." is unchanged, because "Y' is found after.</li>
  <li>"There is CcatX." is unchanged, because "C' is found before and "X" after.</li>
  </ul>