When using before and after in combination, the opposite behavior was induced. This PR makes the the replacement happen between the specified patterns as intended. * Added integration tests * Add changelog, porting guide entry, and minor doc fixes