<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hello,<br>
<br>
Le 03/05/2012 14:49, CRETE Denis a écrit :
<blockquote
cite="mid:9392_1336049361_4FA27ED1_9392_2782_1_908CBC9017354841B2F32BBEC70A05A101C379B79BE2@THSONEA01CMS01P.one.grp"
type="cite">
<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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
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";}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.PrformatHTMLCar
{mso-style-name:"Préformaté HTML Car";
mso-style-priority:99;
mso-style-link:"Préformaté 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;}
.MsoChpDefault
{mso-style-type:export-only;}
@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]-->
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-GB">Hello,<o:p></o:p></span></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.<o:p></o:p></span></pre>
<pre><span lang="EN-GB">Thank you for any help or documentation on this topic. <o:p></o:p></span></pre>
<p class="MsoNormal"><span
style="font-size: 12pt; font-family: "Times New Roman","serif";"
lang="EN-GB">Denis Crété</span></p>
</div>
</blockquote>
With strsubst(), the detection works, but not the substitution (nor the
repetition):<br>
<br>
<tt>-->strsubst('E+31E+2',"/(\-{0,1}[0-9](?:\.[0-9]*)*E)/"," \\1",
'r')<br>
ans = <br>
E+3 \\1+2 <br>
</tt><br>
You can do it in the following way:<br>
<br>
<tt>myString = "E+31E+2-4.2E-3"<br>
</tt><tt>[v,s] = strsplit(myString,"/(\-{0,1}[0-9](?:\.[0-9]*)*E)/");<br>
s=[ '' ; " "+s];<br>
strcat(s+v)<br>
<br>
</tt>giving<br>
<tt><br>
-->myString = "E+31E+2-4.2E-3"<br>
myString = <br>
E+31E+2-4.2E-3 <br>
<br>
-->[v,s] = strsplit(myString,"/(\-{0,1}[0-9](?:\.[0-9]*)*E)/");<br>
-->s=[ '' ; " "+s];<br>
-->strcat(s+v)<br>
ans =<br>
E+3 1E+2 -4.2E-3 <br>
<br>
<br>
</tt><font face="Arial">For PCRE, a good pointer is:<br>
<a class="moz-txt-link-freetext" 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<br>
<br>
</font>
</body>
</html>