{"id":33,"date":"2004-10-18T11:35:24","date_gmt":"2004-10-18T18:35:24","guid":{"rendered":"http:\/\/www.nicholasgoodman.com\/bt\/blog\/?p=33"},"modified":"2004-10-18T11:35:24","modified_gmt":"2004-10-18T18:35:24","slug":"owa_patternamatch-gotcha","status":"publish","type":"post","link":"http:\/\/www.nicholasgoodman.com\/bt\/blog\/2004\/10\/18\/owa_patternamatch-gotcha\/","title":{"rendered":"owa_pattern.amatch gotcha"},"content":{"rendered":"<p>I&#8217;ve been using regular expressions for years.  A few handy cut, sorts, egreps, and uniqs work wonders on datafiles for quick easy troubleshooting.  I spent an hour or so tracking down what I think is a funny implementation of regular expression matching.  Thought I would quickly post it, and hope google picks it up so that perhaps I can save some poor soul the couple hours I just lost to it.<\/p>\n<p>There is limited information about owa_pattern available; one of the better resources I&#8217;ve found is this <a href=\"http:\/\/www.stormloader.com\/yonghuang\/computer\/OracleRegExp.html\">page <\/a> on stormloader.com.  One of the bits of advice on that page is to:<\/p>\n<blockquote><p><em>Or use the second function in owa_pattern, amatch. This function has an IN parameter that dictates where you want to start to match. For our purpose, we don&#8217;t care so set it to 0. What we want from it is the type of the return value, integer.<\/em><\/p><\/blockquote>\n<p>Examine the next two commands and their results, and perhaps you can glean what the issue is with setting the offset to 0<br \/>\n<i>select DATE_UTC, owa_pattern.amatch(date_utc, 0, &#8216;2004&#8217;) from xxxx<\/i> yields<\/p>\n<table border=\"1\">\n<tr>\n<td>[12\/Jul\/2004:00:07:27<\/td>\n<td>0<\/td>\n<\/tr>\n<tr>\n<td>[12\/Jul\/2004:00:07:37<\/td>\n<td>0<\/td>\n<\/tr>\n<\/table>\n<p><i>select DATE_UTC, owa_pattern.amatch(date_utc, 9, &#8216;2004&#8217;) from xxxx<\/i> yields<\/p>\n<table border=\"1\">\n<tr>\n<td>[12\/Jul\/2004:00:07:27<\/td>\n<td>13<\/td>\n<\/tr>\n<tr>\n<td>[12\/Jul\/2004:00:07:37<\/td>\n<td>13<\/td>\n<\/tr>\n<\/table>\n<p>The offset, or where to start, doesn&#8217;t necessarily mean that that is where the pattern matching will begin to scan for the pattern.  It most literally means that the pattern must start at that offset.  I&#8217;m not a huge expert on regex, but I wonder why a function that is supposed to tell YOU where the regular expression exists in the string requires that it start on an offset specified.  Anyone have a perspective or a different experience (perhaps I&#8217;m looking at this improperly)?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been using regular expressions for years. A few handy cut, sorts, egreps, and uniqs work wonders on datafiles for quick easy troubleshooting. I spent an hour or so tracking down what I think is a funny implementation of regular expression matching. Thought I would quickly post it, and hope google picks it up so [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[10],"tags":[],"_links":{"self":[{"href":"http:\/\/www.nicholasgoodman.com\/bt\/blog\/wp-json\/wp\/v2\/posts\/33"}],"collection":[{"href":"http:\/\/www.nicholasgoodman.com\/bt\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.nicholasgoodman.com\/bt\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.nicholasgoodman.com\/bt\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.nicholasgoodman.com\/bt\/blog\/wp-json\/wp\/v2\/comments?post=33"}],"version-history":[{"count":0,"href":"http:\/\/www.nicholasgoodman.com\/bt\/blog\/wp-json\/wp\/v2\/posts\/33\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.nicholasgoodman.com\/bt\/blog\/wp-json\/wp\/v2\/media?parent=33"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.nicholasgoodman.com\/bt\/blog\/wp-json\/wp\/v2\/categories?post=33"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.nicholasgoodman.com\/bt\/blog\/wp-json\/wp\/v2\/tags?post=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}