<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>my2cents &#187; Oracle</title>
	<atom:link href="http://www.frightanic.com/tag/oracle/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.frightanic.com</link>
	<description>&#34;The Earth was made round so that we would not see too far down the road&#34; - Karen Blixen</description>
	<lastBuildDate>Sat, 04 Sep 2010 07:13:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Oracle regular expression aka regexp, issues with character class</title>
		<link>http://www.frightanic.com/2009/09/22/oracle-regular-expression-aka-regexp-issues-with-character-class/</link>
		<comments>http://www.frightanic.com/2009/09/22/oracle-regular-expression-aka-regexp-issues-with-character-class/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 20:30:52 +0000</pubDate>
		<dc:creator>frightanic</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[regexp]]></category>
		<category><![CDATA[regular expression]]></category>

		<guid isPermaLink="false">http://www.frightanic.com/?p=325</guid>
		<description><![CDATA[In most programming languages the regular expression pattern to find the digit &#8217;1&#8242; surrounded by &#8216;;&#8217; and other digits would be something like [;\d]*1[;\d]* So, the pseudo character class &#8220;; or digit&#8221; is matched zero or more times, then the digit 1 is matched followed by zero or more &#8220;; or digit&#8221;s. A few examples: [...]]]></description>
			<content:encoded><![CDATA[<p>In most programming languages the regular expression pattern to find the digit &#8217;1&#8242; surrounded by &#8216;;&#8217; and other digits would be something like</p>
<pre>[;\d]*1[;\d]*</pre>
<p>So, the pseudo character class &#8220;; or digit&#8221; is matched zero or more times, then the digit 1 is matched followed by zero or more &#8220;; or digit&#8221;s. A few examples:</p>
<pre>&lt;property id="foo" value="<span style="background-color: #ffff00;">;1;;;</span>"/&gt;
yet another regexp test with <span style="background-color: #ffff00;">1;;;;3</span>xxyyzz...
well I think you get the picture with this <span style="background-color: #ffff00;">;;;;1</span> shizzle even if it's <span style="background-color: #ffff00;">;1;2;3;</span> or <span style="background-color: #ffff00;">123</span></pre>
<p>With Oracle SQL, however, it&#8217;s a slightly different story. \d is not supported i.e. not properly recognized as being the character class for digits. However, the character class 0-9 which generally is the equivalent to \d seems to be supported. In Oracle you could therefore use</p>
<pre>[;0-9]*1[;0-9]*</pre>
<p>As far as I can tell this is an undocumented feature. The <a href="http://download.oracle.com/docs/cd/B14117_01/server.101/b10759/ap_posix001.htm#i690533" target="_blank">official Oracle regexp documentation</a> only mentions that it supports the regular POSIX character class [:digit:]. Watch out, the equivalent to \d is the whole expression [:digit:] and not just :digit:. I was first fooled by the extra [] around the character class designator&#8230; So, according to the documentation you&#8217;d have to use</p>
<pre>[;[:digit:]]*1[;[:digit:]]*</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.frightanic.com/2009/09/22/oracle-regular-expression-aka-regexp-issues-with-character-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
