Do you always want to change the first word, or only if it is equal to something?
%line = "This is a sentence";
%first = firstWord(%line);
%rest = restWords(%line);
// Do whatever to %first
%newline = %first SPC %rest;
To replace only words:
function ReplaceWords(%string, %find, %replace){
for(%i=0;%i<getWordCount(%string);%i++){
%word = getWord(%string, %i);
%add = %word;
if(%word $= %find)
%add = %replace;
%return = %i == 0 ? %add : %return SPC %add;
}
return %return;
}