[Scilab-users] strsubst

Iai Masafumi ax iai at axelspace.com
Thu Oct 11 05:56:43 CEST 2012


Using regular expression with strsubst, is there any way to substitute
multiple occurence of matched characters in a string? As my test code
below shows, replacement occurs multiple times when an ordinary string
is searched. But only the first occurence is replaced if regular
expression is used.
I am using ver. 5.3.3 and 5.4.0.

-->txt=msprintf("aaa\tbbb\tccc\tddd\n");

-->a=strsubst(txt,char(9),"*")
 a  =

 aaa*bbb*ccc*ddd

-->b=strsubst(txt,"/\t/", "*", "r")
 b  =

 aaa*bbb	ccc	ddd

-->c=strsubst(txt,"/\t/g", "*", "r")
 c  =

 aaa*bbb	ccc	ddd


Iai



More information about the users mailing list