If the result of using the REGREP (replace regular expression) function should be a null string ("") then the function will return the original string instead.
write [regrep('aaaaa','a+','',1,2)]