<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"Préformaté HTML Car";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
tt
        {mso-style-priority:99;
        font-family:"Courier New";}
span.PrformatHTMLCar
        {mso-style-name:"Préformaté HTML Car";
        mso-style-priority:99;
        mso-style-link:"Préformaté HTML";
        font-family:Consolas;
        color:black;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
p.Preacute, li.Preacute, div.Preacute
        {mso-style-name:"Pr&eacute\,format&eacute\,HTML";
        mso-style-link:"Pr&eacute1\,format&eacute1\,HTML Car1";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;}
span.Preacute1
        {mso-style-name:"Pr&eacute1\,format&eacute1\,HTML Car1";
        mso-style-priority:99;
        mso-style-link:"Pr&eacute\,format&eacute\,HTML";
        font-family:"Courier New";}
span.functionid
        {mso-style-name:functionid;}
span.default
        {mso-style-name:default;}
span.scilabdefault
        {mso-style-name:scilabdefault;}
span.scilabstring
        {mso-style-name:scilabstring;}
span.EmailStyle27
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor=white lang=FR link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'>Thank you so much, Samuel !<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'>Denis<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'>De :</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext'> Samuel Gougeon [mailto:sgougeon@free.fr] <br><b>Envoyé :</b> jeudi 3 mai 2012 21:06<br><b>À :</b> users@lists.scilab.org<br><b>Objet :</b> Re: [scilab-Users] Group definition in regular expression<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Hello,<br><br>Le 03/05/2012 14:49, CRETE Denis a écrit : <o:p></o:p></p><p class=MsoNormal><span lang=EN-GB>Hello,</span><o:p></o:p></p><pre><span lang=EN-GB>I am trying to use strsubst('E+31E+2',searchStr,replaceStr, 'r']) in order to insert a white space (or TAB delimiter) between the exponent (‘3’ in this example, but any digit in general) and the mantissa (‘1’ in this case, but any digit in general) of the first argument (a long series of numbers in scientific format). I did not figure out what replaceStr should look like to refer to groups – defined by patterns in parenthesis in searchStr. In this case, this would be used to defined a group with the exponent, with proper sign and magnitude between the symbol E and the inserted delimiter.</span><o:p></o:p></pre><pre><span lang=EN-GB>Thank you for any help or documentation on this topic.  </span><o:p></o:p></pre><p class=MsoNormal><span lang=EN-GB style='font-size:12.0pt;font-family:"Times New Roman","serif"'>Denis Crété</span><o:p></o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>With strsubst(), the detection works, but not the substitution (nor the repetition):<br><br></span><tt><span style='font-size:10.0pt'>-->strsubst('E+31E+2',"/(\-{0,1}[0-9](?:\.[0-9]*)*E)/"," <a href="file:///\\1">\\1</a>", 'r')</span></tt><span style='font-size:10.0pt;font-family:"Courier New"'><br><tt> ans  = </tt><br><tt> E+3 <a href="file:///\\1+2">\\1+2</a>   </tt><br></span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><br>You can do it in the following way:<br><br></span><tt><span style='font-size:10.0pt'>myString = "E+31E+2-4.2E-3"</span></tt><span style='font-size:10.0pt;font-family:"Courier New"'><br><tt>[v,s] = strsplit(myString,"/(\-{0,1}[0-9](?:\.[0-9]*)*E)/");</tt><br><tt>s=[ '' ; " "+s];</tt><br><tt>strcat(s+v)</tt><br><br></span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>giving<br></span><span style='font-size:10.0pt;font-family:"Courier New"'><br><tt>-->myString = "E+31E+2-4.2E-3"</tt><br><tt> myString  = </tt><br><tt> E+31E+2-4.2E-3   </tt><br><tt> </tt><br><tt>-->[v,s] = strsplit(myString,"/(\-{0,1}[0-9](?:\.[0-9]*)*E)/");</tt><br><tt>-->s=[ '' ; " "+s];</tt><br><tt>-->strcat(s+v)</tt><br><tt> ans  =</tt><br><tt> E+3 1E+2 -4.2E-3   </tt><br><tt> </tt><br><br></span><span style='font-size:12.0pt;font-family:"Arial","sans-serif"'>For PCRE, a good pointer is:<br><a href="http://www.php.net/manual/fr/reference.pcre.pattern.syntax.php">http://www.php.net/manual/fr/reference.pcre.pattern.syntax.php</a><br><br>Regards<br>Samuel Gougeon</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p></div></body></html>