On Sat, Apr 30, 2022 at 3:16 AM Johannes Sixt <j6t@xxxxxxxx> wrote: > I am a bit reluctant to diagnose what exactly is happening here because > your word regex is outside the design space. It is definitely not a good > idea to declare whitespace and even line breaks as part of a word. And > in fact, when you remove the trailing (\\r\\n?|\\n\\r?)?, you get a more > sensible word diff: > > var result =[-((-] resx.State == ResultState.Succeeded[-) &&-] > [-string.IsNullOrEmpty(res.ErrorCode) )-] ? (byte)0 : (byte)1; > > But if I were you, I would remove all subexpressions that match any form > of whitespace. Interesting... IIRC, the reason for the leading and trailing line breaks in the regex is to stop the diff from messing up the alignment of multiple edited lines. I don't remember the exact sequence I was seeing, but removing them doesn't appear to mess up the alignment so badly anymore. Still, I'm surprised that removing that trailing line break capture would have caused the issue seen here. For now, I'll remove the captures and if I see what I was seeing before, I'll report back to the group. Thanks, Jaz