{"id":7200,"date":"2013-03-28T16:42:30","date_gmt":"2013-03-28T21:42:30","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=7200"},"modified":"2013-03-28T16:42:30","modified_gmt":"2013-03-28T21:42:30","slug":"regular-expression-to-match-multiples-of-3","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2013\/03\/28\/regular-expression-to-match-multiples-of-3\/","title":{"rendered":"Regular Expression to Match Multiples of 3"},"content":{"rendered":"<p><a href=\"http:\/\/alokmenghrajani.github.com\/triple\/\">Alok Menghrajani<\/a> (via <a href=\"https:\/\/twitter.com\/nst021\/status\/317213353502191616\">Nicolas Seriot<\/a>):<\/p>\n<blockquote cite=\"http:\/\/alokmenghrajani.github.com\/triple\/\"><p>An easier way to solve the problem requires understanding that regular expressions can be written as finite state machines, and vice versa. [&#8230;] The state machine is going to process the input and keep track of the sum of the digits. We only need the sum modulo 3, so we&rsquo;ll have a pretty simple state machine with 3 states: state A (starting state), state B (we are off by 1), state C (we are off by 2).<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Alok Menghrajani (via Nicolas Seriot): An easier way to solve the problem requires understanding that regular expressions can be written as finite state machines, and vice versa. [&#8230;] The state machine is going to process the input and keep track of the sum of the digits. We only need the sum modulo 3, so we&rsquo;ll [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[263,71,234],"class_list":["post-7200","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-theory","tag-programming","tag-regex"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/7200","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=7200"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/7200\/revisions"}],"predecessor-version":[{"id":7201,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/7200\/revisions\/7201"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=7200"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=7200"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=7200"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}