afaik that whole part about the substrings has never worked.
You could solve this problem by using my RegExpExtract function. Instead of removing patterns it will return them.
//Opposite of RegExpReplace, returns all matches as one string.
//Needs xsplit!
function RegExpExtract(const Pattern: string; const Source: string): string;
var
a: string;
i: integer;
s: array of string;
begin
if RegExpMatch(Pattern, Source) then begin
a := RegExpReplace(Pattern, Source, '@@CUT@@', true)+'@@CUT@@';
a := RegExpReplace('[\\\?\*\(\)\{\}\[\]\|\+\$\^]',a, '\.', true);
s := xsplit(a, '@@CUT@@');
result := Source;
for i:=0 to (getArrayLength(s)-2) do
if s[i] <> '' then
result := RegExpReplace(s[i], result, '', true);
end;
end;
In this case:
result := RegExpExtract('\w+$', Text)+' '+RegExpExtract('^\w+', Text)
^ and $ symbolize the start and end of an string.
Using the extract function might make it a bit easier then using only RegExpReplace, but you don't actually need it. However it might give you an example how to create your own regexp function that WILL return substrings the way you like it.