RegEx weirdness

Hello,

can someone please take a look at my demo project? There are two string constants with lines following a pattern.
The pattern looks like this:

Level +[Reference] + Tag +[Value]

The parts in square brackets [] are each optional.

In a TextArea all tags, references and values (if they begin and end with @), should now be displayed in color.

The first string is searched correctly and the desired parts are formatted. The second string that follows exactly the same pattern does not. Why?

SubExpressionStartB returns the byte position however you have characters in the string which can take multiple bytes e.g. ü, so the position that you’re setting the colour to is incorrect.

Here’s a modified version with the code taken from the bottom of: https://documentation.xojo.com/index.php/RegExMatch.SubExpressionStartB

https://www.dropbox.com/s/edu1o5j2rvo0gf4/RegEx%20wrong%20Matches-FIXED.xojo_binary_project?dl=1

[quote=385300:]SubExpressionStartB returns the byte position however you have characters in the string which can take multiple bytes e.g. ü, so the position that you’re setting the colour to is incorrect.

Here’s a modified version with the code taken from the bottom of:[/quote]
Julian, thank you very much. As of today you are nominated as Xojoian of the year 2018 :wink: