<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[REGEX with Serial Input Data Point]]></title><description><![CDATA[<p dir="auto">In my lab I periodically run a moisture test on the germination and kilning of the malt.  I use a moisture balance that outputs the test results as ASCII text on a RS232 serial port.  I need some help extracting the moisture value from the output strings to enter as a data point.</p>
<h2>The output looks like this:</h2>
<p dir="auto">*****    AUTO  STOP    *****<br />
LAST TEMP:           131 C<br />
FINAL MASS:       12.215 g<br />
TEST TIME:           56:15<br />
MASS LOST:         8.531 g<br />
RESULT:           41.12 %M<br />
----------------------------- (the dashes are mine)<br />
I need to extract just the value (in this case 41.12) from the "RESULT:" line using REGEX.  I am NOT very good with regular expressions and have been pulling my hair out all morning.  The best I have come up with is: "/RESULT:\s*([\d][\d].[\d][\d])\s%M*/g" but that selects the entire line, not just the value.  Any help would be very appreciated.</p>
]]></description><link>https://forum.mango-os.com/topic/3183/regex-with-serial-input-data-point</link><generator>RSS for Node</generator><lastBuildDate>Fri, 12 Jun 2026 14:41:21 GMT</lastBuildDate><atom:link href="https://forum.mango-os.com/topic/3183.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 03 Jan 2018 18:01:32 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to REGEX with Serial Input Data Point on Thu, 04 Jan 2018 16:18:09 GMT]]></title><description><![CDATA[<p dir="auto">Hi Tom,</p>
<p dir="auto">At the bottom of the edit point page is a section for event detectors. You're either looking for a Change or Update  detector. After the event detector is created, you will need to create an Email event handler on the /event_handlers.shtm page for the event, and you will need to configure your SMTP server in the system settings.</p>
]]></description><link>https://forum.mango-os.com/post/16716</link><guid isPermaLink="true">https://forum.mango-os.com/post/16716</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Thu, 04 Jan 2018 16:18:09 GMT</pubDate></item><item><title><![CDATA[Reply to REGEX with Serial Input Data Point on Thu, 04 Jan 2018 16:34:21 GMT]]></title><description><![CDATA[<p dir="auto">I connected the moisture balance as a serial data source and it works.  I get the percent moisture value as an alpha-numeric which is fine for logging.  I don't need any charting.  I changed the Regex to include "%M" so a unit is displayed when looking at point details.</p>
<p dir="auto">The data source (moisture balance RS232) sends a 0x04 (EOT End Of Transmission) at the end of each message.  If I try to use a terminator string of 0x04 it won't work.  If I ignore the terminator it does work, so no big deal.  Just curious  why I cant use the hex value 0x04 as a terminator.  Is there another encoding that would work?</p>
<p dir="auto">Now I need to figure out how to have the result emailed to me when the data point is logged.<br />
Tom</p>
]]></description><link>https://forum.mango-os.com/post/16715</link><guid isPermaLink="true">https://forum.mango-os.com/post/16715</guid><dc:creator><![CDATA[thutchis]]></dc:creator><pubDate>Thu, 04 Jan 2018 16:34:21 GMT</pubDate></item><item><title><![CDATA[Reply to REGEX with Serial Input Data Point on Thu, 04 Jan 2018 16:00:39 GMT]]></title><description><![CDATA[<p dir="auto">I was able to get the REGEX tester to duplicate your results and got the value as group 1.</p>
<p dir="auto">Thanks for your help today, I learned a lot.  I plan to connect the serial data source to the Mango server tomorrow.  I'll see what happens then.</p>
<p dir="auto">Tom</p>
]]></description><link>https://forum.mango-os.com/post/16711</link><guid isPermaLink="true">https://forum.mango-os.com/post/16711</guid><dc:creator><![CDATA[thutchis]]></dc:creator><pubDate>Thu, 04 Jan 2018 16:00:39 GMT</pubDate></item><item><title><![CDATA[Reply to REGEX with Serial Input Data Point on Wed, 03 Jan 2018 22:22:33 GMT]]></title><description><![CDATA[<p dir="auto">It shows that value was extracted as group #1, which would be the value group index in Mango.</p>
<p dir="auto">It looks like I was supposed to have written <code>(\d+\.?\d*)</code> but the \ before the dot was removed the forum's formatting, and so I didn't copy it into the image. But, it would work either way.</p>
]]></description><link>https://forum.mango-os.com/post/16710</link><guid isPermaLink="true">https://forum.mango-os.com/post/16710</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Wed, 03 Jan 2018 22:22:33 GMT</pubDate></item><item><title><![CDATA[Reply to REGEX with Serial Input Data Point on Wed, 03 Jan 2018 21:58:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/phildunlap" aria-label="Profile: phildunlap">@<bdi>phildunlap</bdi></a> said in <a href="/post/16706">REGEX with Serial Input Data Point</a>:</p>
<blockquote>
<p dir="auto">[^;]+</p>
</blockquote>
<p dir="auto">Strange, I didn't use the spaces after/before the double quotes, they was only to indicate the quotes were not included in the expression I was trying to convey to the reader.  But I still don't get a match.  Your screen shot shows the entire message was matched, not just the value between "RESULT:" and "%M".</p>
]]></description><link>https://forum.mango-os.com/post/16709</link><guid isPermaLink="true">https://forum.mango-os.com/post/16709</guid><dc:creator><![CDATA[thutchis]]></dc:creator><pubDate>Wed, 03 Jan 2018 21:58:41 GMT</pubDate></item><item><title><![CDATA[Reply to REGEX with Serial Input Data Point on Wed, 03 Jan 2018 21:25:33 GMT]]></title><description><![CDATA[<p dir="auto">Hmm, that is not my experience with that website:<br />
<img src="https://camo.nodebb.org/76168c16701f04f42f79b6b33044e9c6c306f67a?url=https%3A%2F%2Fi.imgur.com%2FrW7lShN.png" alt="0_1515014650954_myRegexWorks.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">Perhaps it is from the extra spaces inside your quote marks?</p>
]]></description><link>https://forum.mango-os.com/post/16708</link><guid isPermaLink="true">https://forum.mango-os.com/post/16708</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Wed, 03 Jan 2018 21:25:33 GMT</pubDate></item><item><title><![CDATA[Reply to REGEX with Serial Input Data Point on Wed, 03 Jan 2018 21:12:58 GMT]]></title><description><![CDATA[<p dir="auto">Thanks Phil,<br />
Yes, I plan to use a Serial Data Source.</p>
<p dir="auto">I am using a Regex tester at: <a href="https://regexr.com/" rel="nofollow ugc">https://regexr.com/</a> to work out the correct syntax for getting my desired value into a data point.  If I put your suggestion, " [^;]+RESULT: (\d+.?\d*) %M.* " in the tester it shows "no match".  I would assume the Mango REGEX parser would perform the same.</p>
]]></description><link>https://forum.mango-os.com/post/16707</link><guid isPermaLink="true">https://forum.mango-os.com/post/16707</guid><dc:creator><![CDATA[thutchis]]></dc:creator><pubDate>Wed, 03 Jan 2018 21:12:58 GMT</pubDate></item><item><title><![CDATA[Reply to REGEX with Serial Input Data Point on Wed, 03 Jan 2018 22:20:51 GMT]]></title><description><![CDATA[<p dir="auto">Hi thutchis,</p>
<p dir="auto">You are using a serial data source?</p>
<p dir="auto">It sounds like if you used a value index of 1 instead of 0 you should be extracting your value, currently. You don't need to use the  <code>/.../g</code> type format to input the regex, you can enter what would come between the slashes for the serial data source fields.</p>
<p dir="auto">I always encourage people to do their troubleshooting using a setup that will catch all the values, for your data, that might mean something like...</p>
<p dir="auto">DATA SOURCE:<br />
Use terminator: No<br />
Message Regex: ()[^;]+<br />
Point Identifier Group: 1<br />
Configuration in Hex: No</p>
<p dir="auto">DATA POINT:<br />
Data Type: Alphanumeric<br />
Point Identifier:<br />
Value Group: 0<br />
Value Regex [^;]+</p>
<p dir="auto">I am using [^;]+ because you do not have any semicolons in your example data, so it will match everything. You could probably get the specific value you're looking for with a serial data point setup on that data source like,</p>
<pre><code>DATA POINT:
Data Type: Alphanumeric
Point Identifier:
Value Group: 1
Value Regex [^;]+RESULT: (\d+\.?\d*) %M.*
</code></pre>
]]></description><link>https://forum.mango-os.com/post/16706</link><guid isPermaLink="true">https://forum.mango-os.com/post/16706</guid><dc:creator><![CDATA[phildunlap]]></dc:creator><pubDate>Wed, 03 Jan 2018 22:20:51 GMT</pubDate></item></channel></rss>