{"id":2606,"date":"2014-11-28T17:22:41","date_gmt":"2014-11-28T17:22:41","guid":{"rendered":"http:\/\/www.hexacorn.com\/blog\/?p=2606"},"modified":"2014-11-28T17:22:41","modified_gmt":"2014-11-28T17:22:41","slug":"regulex-visualized-regexes","status":"publish","type":"post","link":"https:\/\/www.hexacorn.com\/blog\/2014\/11\/28\/regulex-visualized-regexes\/","title":{"rendered":"Regulex &#038; Visualized regexes"},"content":{"rendered":"<p>A few days ago I noticed a twit referring to <a href=\"http:\/\/jex.im\/regulex\/\">http:\/\/jex.im\/regulex\/<\/a>, a home page for a cute engine that visualizes regular expressions. It is great!<\/p>\n<p>If you struggle with regular expressions, or just want to toy around this is an excellent tool for learning and testing purposes; it may be also a good way to enrich forensic \/ investigation reports.<\/p>\n<p>Let&#8217;s see what it can do by feeding it a few examples:<\/p>\n<p><strong>Track data<\/strong><\/p>\n<p>In my <a href=\"https:\/\/www.hexacorn.com\/blog\/2012\/12\/19\/malware-attacking-pos-systems\/\">old post from 2012<\/a> about POS malware I mentioned a sample D9A3FB2BFAC89FEA2772C7A73A8422F2 that contains regular expressions used to parse track data; here they are:<\/p>\n<ul>\n<li>Track 1\n<ul>\n<li>((b|B)[0-9]{13,19}\\^[A-Za-z\\s]{0,30}\\\/[A-Za-z\\s]{0,30}\\^(0[7-9]|1[0-5])((0[1-9])|(1[0-2]))[0-9\\s]{3,50}[0-9]{1})<\/li>\n<\/ul>\n<\/li>\n<li>Track 2\n<ul>\n<li>([0-9]{15,16}[D=](0[7-9]|1[0-5])((0[1-9])|(1[0-2]))[0-9]{8,30})<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>Feeding them to Regulex gives us the following results:<\/p>\n<ul>\n<li>Track 1<\/li>\n<\/ul>\n<p><a href=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2014\/11\/regulex_t1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-2607 size-medium\" src=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2014\/11\/regulex_t1-300x77.png\" alt=\"regulex_t1\" width=\"300\" height=\"77\" srcset=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2014\/11\/regulex_t1-300x77.png 300w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2014\/11\/regulex_t1-1024x263.png 1024w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2014\/11\/regulex_t1-990x250.png 990w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2014\/11\/regulex_t1.png 1443w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<ul>\n<li>Track 2<\/li>\n<\/ul>\n<p><a href=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2014\/11\/regulex_t2.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-2608 size-medium\" src=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2014\/11\/regulex_t2-300x132.png\" alt=\"regulex_t2\" width=\"300\" height=\"132\" srcset=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2014\/11\/regulex_t2-300x132.png 300w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2014\/11\/regulex_t2.png 849w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>When converted by Regulex, they make a lot of sense and are very readable.<\/p>\n<p><strong>Email<\/strong><\/p>\n<p>Using an example regex to validate email presented on <a href=\"http:\/\/www.regular-expressions.info\/email.html\">http:\/\/www.regular-expressions.info\/email.html<\/a>:<\/p>\n<p>[a-z0-9!#$%&amp;&#8217;*+\/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&amp;&#8217;*+\/=?^_`{|}~-]+)*@ (?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+(?:[A-Z]{2}|com|org|net|edu|gov|mil| biz|info|mobi|name|aero|asia|jobs|museum)\\b<\/p>\n<p>we can get the following diagram:<\/p>\n<p><a href=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2014\/11\/regulex_email.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-2610 size-medium\" src=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2014\/11\/regulex_email-300x153.png\" alt=\"regulex_email\" width=\"300\" height=\"153\" srcset=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2014\/11\/regulex_email-300x153.png 300w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2014\/11\/regulex_email-1024x524.png 1024w, https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2014\/11\/regulex_email.png 1406w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a>Awesome, isn&#8217;t it ?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A few days ago I noticed a twit referring to http:\/\/jex.im\/regulex\/, a home page for a cute engine that visualizes regular expressions. It is great! If you struggle with regular expressions, or just want to toy around this is an &hellip; <a href=\"https:\/\/www.hexacorn.com\/blog\/2014\/11\/28\/regulex-visualized-regexes\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[31],"tags":[],"_links":{"self":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/2606"}],"collection":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/comments?post=2606"}],"version-history":[{"count":6,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/2606\/revisions"}],"predecessor-version":[{"id":2617,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/2606\/revisions\/2617"}],"wp:attachment":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/media?parent=2606"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/categories?post=2606"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/tags?post=2606"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}