<div dir="ltr"><div><div><div><div><div>Hi,<br><br></div>As Gerd pointed out not an easy problem. However, Perl will automatically take the numeric part of a variable if you do a arithmetic operation. For example, if you do the following.<br>
<br></div>$vx = $vi_submitted+1;<br></div>$vx--;<br><br></div>then $vx will be just the numeric value. Works with exp too but not something like 1.23x10^3 m/s.  <br><br></div>-hk<br><br><div class="gmail_extra"><br><div class="gmail_quote">
On Thu, Oct 17, 2013 at 7:37 AM, Gerd Kortemeyer <span dir="ltr"><<a href="mailto:korte@lite.msu.edu" target="_blank">korte@lite.msu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<div class="im"><br>
On Oct 17, 2013, at 7:08 AM, Jon Hall <<a href="mailto:jdh65@bellsouth.net">jdh65@bellsouth.net</a>> wrote:<br>
<br>
><br>
> Is there an easy way to access just the numeric portion of a student's submitted answer?<br>
><br>
> In other words, if a student submits 54.6 m/s as an answer, is there a way to strip the non-numeric characters to use just the 54.6 as a point on a gnuplot, for example?<br>
><br>
><br>
> So my script would include:<br>
><br>
> $vi_submitted=&EXT('user.resource.resource.15.16.submission');<br>
><br>
> but then what?<br>
<br>
</div>Not easy at all, since the number could include scientific notation, etc. The regular expression used within LON-CAPA itself to make the separation is rather complicated, and we needed to fix it more than once :-(.<br>

<br>
But I would recommend against this anyway, since the number alone does not make *any* sense. How would the plot consider the equivalence between 54.6 m/s and 0.0546 km/s?<br>
<br>
If your problem expects certain units, I would recommend to give them to the student. Either make the question text specify "in m/s" or write that behind the answer box, e.g.<br>
<br>
[    ] m/s<br>
<span class="HOEnZb"><font color="#888888"><br>
- Gerd.<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
LON-CAPA-users mailing list<br>
<a href="mailto:LON-CAPA-users@mail.lon-capa.org">LON-CAPA-users@mail.lon-capa.org</a><br>
<a href="http://mail.lon-capa.org/mailman/listinfo/lon-capa-users" target="_blank">http://mail.lon-capa.org/mailman/listinfo/lon-capa-users</a><br>
<br>
<br>
</div></div></blockquote></div><br></div></div>