Fix substring position update logic in capReplace

    - previous logic adjusted all substrings "after" the positions of
      the updated substring (in terms of position in the array);
      new logic adjusts all substrings after the positions in terms
      of position in the string itself
Merge pull request #1 from DiggidyDave/master

Fix substring position update logic in capReplace