smourier/TraceSpy

Regex colorizers cannot match multiple lines

Closed this issue · 3 comments

A regex colorizer cannot seem to match an output which goes over multiple lines. I do have Wrap Text enabled.

I have tried adding the regular expressions <?<test>(.|\n|\r)*) and <?<test>(?s:.*)). I am printing the following ODS:

print("foo\nbar");

The result I'm seeing is this:
Print color highlight

It appears to realize that there is a second line, but it simply does not display it.

Hi,

Thanks for reporting that.

Yes, it looks like a regression ... In fact it does that even without any regex colorizers... I will take a look at that

It appears that regex colorizers still have a few issues. I'm using the following pattern: (?<debug>(?!\[ASL/?\d*\])\[.*\](.|\n)*).
It should match the following conditions: a string must not begin with [ASL], [ASL/], or [ASL/1234] (with any amount of numbers), but must begin with any other string between [], followed by any character or a new line.

Examples of matches:

[Foo] Bar
[Foo ASL] Bar
[] Foo
Bar

Examples of non-matches:

Foo
[ASL] Foo
[ASL/1234] Foo
Bar

Testing this in online regex testers (https://regexr.com, http://regexstorm.net/tester) would lead me to believe that my pattern spans over multiple lines (with only 1 match detected), but TraceSpy does not appear to capture both lines:

Non-match

However, the simple pattern (?<test>(.|\n)*) does appear to work:

Match

I'm not a regex expert, but with this

(?<debug>(?!\[ASL/?\d*\])\[.*\](.|\n)*)

regex, and this

[] Foo
Bar

input, the .NET regex used here, configured with Compiledand IgnoreCase (https://docs.microsoft.com/en-us/dotnet/api/system.text.regularexpressions.regexoptions) will match multiple groups, but only one named ("debug") that contains only [] Foo, so TraceSpy will only colorize the first group, so what you see is expected.