Always capture slice when pattern requires checking the length Fixes #111751 cc ``@zirconium-n,`` I see you were assigned to this but I've fixed some similar issues in the past and had an idea on how to investigate this.