Return pooled arrays in Regex.Replace when no replacements (#44833)
When Regex.Replace doesn't actually need to replace anything, we're inadvertently not returning a previously rented ArrayPool array to the pool. On repeated use, that drains the pool of the desired size, such that every attempt ends up allocating a new array, even if there are no replacements to be made.
The fix is to lazily rent from the pool. This not only fixes the problem, but helps perf further by not taking the rental cost unless we actually need an array to store a replacement segment.