assuming you have a global variable &testStr, and it's contents are 'testing 123 fgiafg %date% hidsfau 4'
show(&origStr) would reveal this:- 'testing 123 fgiafg|%date%|hidsfau 4'
one of the many ways to do this would be
-you can find out where your string starts using pos(); pos('%date%',&testStr) would be 20
-know that the length of %date% is 6, making your end 26
-know how long &origStr is using length()
-know how to split up your string using mid()
define(&replaceStr,string,'')
define(&start,integer,pos('%date%',&orgStr))
define(&end,integer,length(&orgStr))
&replaceStr := mid(&orgStr,1,&start - 1) + 'whatever you want' + mid(&orgStr,26,&end)
crlf()
show(&replaceStr)
crlf()
show(&orgStr)