Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

RegEx Not Preceeded By or Followed By

963434Sep 20 2012 — edited Sep 21 2012
I am trying to find references in a varchar column that contains two digits but is not preceeded by a : and is not followed by digits. I am trying to do this via Regular Expressions.
I would like the following returned:
22hihi
22hihi22
But not:
:22hi
:22
2222
This seems like a fairly straight forward thing but I am having difficulties with it. This is on a Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit

This is what I have tried as a text. I would think this would not return a match because the first [^:] would exclude the string.

select case when regexp_like(':123', '[^:]\d{2}') then 'Match Found' else 'No Match Found' end as columnname1 from dual
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 19 2012
Added on Sep 20 2012
8 comments
800 views