In most programming languages the regular expression pattern to find the digit ‘1’ surrounded by ‘;’ and other digits would be something like
1 | [;\d]*1[;\d]* |
So, the pseudo character class “; or digit” is matched zero or more times, then the digit 1 is matched followed by zero or more “; or digit”s. A few examples:
1 2 3 | <property id="foo" value="<span style="background-color: #ffff00;">;1;;;</span>"/> 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> |
With Oracle SQL, however, it’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
1 | [;0-9]*1[;0-9]* |
As far as I can tell this is an undocumented feature. The official Oracle regexp documentation 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… So, according to the documentation you’d have to use
1 | [;[:digit:]]*1[;[:digit:]]* |
I stumbled upon the same issue with d not being honored in a user-defined character class. Tx for confirming my sanity.