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

Pierre Vuillemin contact at pierre-vuillemin.fr
Mon Mar 27 17:48:07 CEST 2017


My bad, I didn't see the bug report. Great news though.

Regards,

Pierre


Le 27/03/2017 à 16:43, sgougeon at free.fr a écrit :
> ----- Mail original -----
>> De: "Pierre Vuillemin", Lundi 27 Mars 2017 09:57:01
>>
>> 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?
> No, but after years of being pending after the report
> http://bugzilla.scilab.org/4276
> it was fixed very recently and is already available in the
> Nightly Built 6.0 branch:
> https://codereview.scilab.org/#/c/19144/
>
> Samuel
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users




More information about the users mailing list