[Scilab-users] Replace multiple occurrences of regular expression in string with strsubst

Pierre Vuillemin contact at pierre-vuillemin.fr
Mon Mar 27 09:57:01 CEST 2017


Hi all,

It seems that when using regular expressions with strsubst, only the 
first occurrence is replaced. For instance,

tst_str  = 'This is a cow. A cow is funny.'
out1     = strsubst(tst_str, 'cow', 'rabbit')
out2     = strsubst(tst_str,'/cow/','rabbit','r')
disp(out1) // both occurence are replaced -> ok
disp(out2) // only the first occurence is replaced -> strange?

Is it the intended behaviour?

Regards,

Pierre



More information about the users mailing list