%% an input string, some lines look like <whitespace>Xkey
s1="\nabcdef\n  \t  Xkey\nabcdef\n Xkey\nabcdef\nabcdef\nXkey\nabcdef"

%% find <whitespace>Xkey
% On ARM, in the last case, $1 is incorrectly "X": it should be ""
% On x86, in the last case, $1 is correctly empty
s2 = regexprep(s1, '^([ \t]*)(Xkey)$', '___$1___$2___', ...
               "dotexceptnewline", "emptymatch", "lineanchors")

%% note regexp seems to work correctly
T = regexp(s1, '^([ \t]*)(Xkey)$', ...
           "dotexceptnewline", "emptymatch", "lineanchors", "tokens")

%% note last whitespace token is empty as expected
length(T{1}{1})
length(T{2}{1})
length(T{3}{1})
