{"id":126,"date":"2018-03-07T12:48:51","date_gmt":"2018-03-07T11:48:51","guid":{"rendered":"https:\/\/www.smartlux.com\/sdl\/?p=126"},"modified":"2019-04-17T04:19:30","modified_gmt":"2019-04-17T02:19:30","slug":"version-0-4-with-custom-regular-expressions","status":"publish","type":"post","link":"https:\/\/www.smartlux.com\/sdl\/version-0-4-with-custom-regular-expressions\/","title":{"rendered":"Version 0.4.0 (custom regular expressions)"},"content":{"rendered":"<p>Simple Data Logger just became significantly more powerful (and useful): You can now modify the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Regular_expression\">regular expression<\/a> used to match and capture data.<\/p>\n<p>This is best explained with an example. Let&#8217;s say your scale sends the following data every time you press the print button:<\/p>\n<pre>Balance ID: 8336507294\r\nBalance Type: STX421\r\nBalance Name: Scout\r\nUser Name:\r\nProject Name:\r\nWeighing\r\nSample Name: OBJECT 1\r\n<span class=\"highlight\">123.4 g<\/span>\r\nGross: 123.4 g G\r\nNet: 123.4 g N\r\nTare: 0.0 g T\r\nSignature:____________\r\nVerified By:____________<\/pre>\n<p>However, you actually only want to record the <span class=\"highlight\">net weight<\/span>. This can now be achieved in SDL by clicking on the <strong>customize<\/strong> button in the <strong>device<\/strong> tab:<\/p>\n<p><a href=\"https:\/\/www.smartlux.com\/sdl\/wp-content\/uploads\/sites\/3\/2018\/03\/customize-regex.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-127\" src=\"https:\/\/www.smartlux.com\/sdl\/wp-content\/uploads\/sites\/3\/2018\/03\/customize-regex.png\" alt=\"Capture net weight using custom regular expression\" width=\"564\" height=\"596\" srcset=\"https:\/\/www.smartlux.com\/sdl\/wp-content\/uploads\/sites\/3\/2018\/03\/customize-regex.png 564w, https:\/\/www.smartlux.com\/sdl\/wp-content\/uploads\/sites\/3\/2018\/03\/customize-regex-284x300.png 284w\" sizes=\"auto, (max-width: 564px) 100vw, 564px\" \/><\/a><\/p>\n<p>Adding &#8220;Net:\\s*&#8221; ahead of the original regular expression ensures that only lines where these characters appear before the weight are matched. SDL then uses a capturing group (subexpression) to capture the numeric value (weight).<\/p>\n<div class=\"note\">SDL always captures the data matched by the first subexpression. You must therefore include a subexpression (in parentheses) in your regular expression.<\/div>\n<p>For further information, <a href=\"https:\/\/www.smartlux.com\/blog\/2017\/08\/09\/when-232key-captures-too-many-values\/\">please read this blog post describing the same functionality of our 232key software<\/a>.<\/p>\n<p>We&#8217;ve also made the links in SDL clickable and made sure that user settings are automatically transferred after updating.<\/p>\n<p>Finally, we&#8217;ve relaunched our website, making it significantly more interactive (try it out and leave a comment below). We&#8217;ve also moved it from simpledatalogger.com to <a href=\"https:\/\/www.smartlux.com\/sdl\/\">smartlux.com\/sdl<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Simple Data Logger just became significantly more powerful (and useful): You can now modify the regular expression used to match and capture data. This is best explained with an example. Let&#8217;s say your scale sends the following data every time you press the print button: Balance ID: 8336507294 Balance Type: STX421 Balance Name: Scout User &hellip; <a href=\"https:\/\/www.smartlux.com\/sdl\/version-0-4-with-custom-regular-expressions\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Version 0.4.0 (custom regular expressions)<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_seopress_titles_title":"","_seopress_titles_desc":"Simple Data Logger just became significantly more powerful (and useful): You can now modify the regular expression used to match and capture data. Example: capture and record the net weight sent by a scale and ignore all other data.","_seopress_robots_index":"","_seopress_robots_follow":"","_seopress_robots_imageindex":"","_seopress_robots_snippet":"","_seopress_robots_primary_cat":"","_seopress_robots_breadcrumbs":"","_seopress_robots_freeze_modified_date":"","_seopress_robots_custom_modified_date":"","_seopress_robots_canonical":"","_seopress_social_fb_title":"","_seopress_social_fb_desc":"","_seopress_social_fb_img":"","_seopress_social_fb_img_attachment_id":0,"_seopress_social_fb_img_width":0,"_seopress_social_fb_img_height":0,"_seopress_social_twitter_title":"","_seopress_social_twitter_desc":"","_seopress_social_twitter_img":"","_seopress_social_twitter_img_attachment_id":0,"_seopress_social_twitter_img_width":0,"_seopress_social_twitter_img_height":0,"_seopress_redirections_value":"","_seopress_redirections_enabled":"","_seopress_redirections_enabled_regex":"","_seopress_redirections_logged_status":"","_seopress_redirections_param":"","_seopress_redirections_type":0,"_seopress_analysis_target_kw":"","_seopress_news_disabled":"","_seopress_video_disabled":"","_seopress_video":[],"_seopress_pro_schemas_manual":[],"_seopress_pro_rich_snippets_disable_all":"","_seopress_pro_rich_snippets_disable":[],"_seopress_pro_schemas":[],"footnotes":""},"categories":[13],"tags":[7,16,14,6],"class_list":["post-126","post","type-post","status-publish","format-standard","hentry","category-changelog","tag-balances","tag-net-weight","tag-regular-expression","tag-scales"],"_links":{"self":[{"href":"https:\/\/www.smartlux.com\/sdl\/wp-json\/wp\/v2\/posts\/126","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.smartlux.com\/sdl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.smartlux.com\/sdl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.smartlux.com\/sdl\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.smartlux.com\/sdl\/wp-json\/wp\/v2\/comments?post=126"}],"version-history":[{"count":9,"href":"https:\/\/www.smartlux.com\/sdl\/wp-json\/wp\/v2\/posts\/126\/revisions"}],"predecessor-version":[{"id":499,"href":"https:\/\/www.smartlux.com\/sdl\/wp-json\/wp\/v2\/posts\/126\/revisions\/499"}],"wp:attachment":[{"href":"https:\/\/www.smartlux.com\/sdl\/wp-json\/wp\/v2\/media?parent=126"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.smartlux.com\/sdl\/wp-json\/wp\/v2\/categories?post=126"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.smartlux.com\/sdl\/wp-json\/wp\/v2\/tags?post=126"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}