There appears to be a difference in handling the key between Berlin and Tokyo.
When I change the code to:
procedure TForm3.RefreshEdit;
const
STR_REGEX = '([A-Z]+\s*:)|([A-Z0-9]+)+|\s*';
var
idx : Integer;
ss : Integer;
sl : Integer;
matches: TMatchCollection;
begin
TMSFMXRichEditor1.CaretToSelection;
ss := TMSFMXRichEditor1.SelStart;
sl := TMSFMXRichEditor1.SelLength;
TMSFMXRichEditor1.BeginUpdate;
try
matches := TRegEx.matches(TMSFMXRichEditor1.PlainText, STR_REGEX, [roIgnoreCase]);
for idx := 0 to matches.Count - 1 do
begin
TMSFMXRichEditor1.SelStart := matches[idx].Index - 1;
TMSFMXRichEditor1.SelLength := matches[idx].Length;
if matches[idx].Value.Contains(':') then
TMSFMXRichEditor1.SetSelectionColor(TAlphaColorRec.Red)
else
TMSFMXRichEditor1.SetSelectionColor(TAlphaColorRec.Black);
end;
finally
TMSFMXRichEditor1.SelStart := ss;
TMSFMXRichEditor1.SelLength := sl;
TMSFMXRichEditor1.SelectionToCaret;
TMSFMXRichEditor1.EndUpdate;
end;
end;
it starts to work for Delphi 10.1 Berlin.