It looks that work fine and here is both Right() & Replace()
#lookahead
string text
string r$,w$,out
text="oxygenbasic"
r$="Dev"
w$="basic"
out=""
'test Replace()
out = Replace(text,w$,r$)
print out 'out -> oxygenDev
'test Right()
out = Right(out,3)
print out 'out -> Dev
FUNCTION Replace(t as string,w as string,r as string) As String
'=======================================
'
sys a,b,lw,lr
string s=t
'
lw=Len w
lr=Len r
a=1
'
DO
a=INSTR a,s,w
IF a=0 THEN EXIT DO
s=LEFT(s,a-1)+r+MID(s,a+lw)
a=a+lr
END DO
RETURN s
END FUNCTION
FUNCTION Right(getStr As String,rLen As Int) As String
String retStr
retStr = MID(getStr,-rLen)
Return retStr
END FUNCTION