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!

REGEXP_LIKE, oh where for art thou?

Xev BellringerJan 8 2014 — edited Jan 10 2014

Hi Guys, it's Xev.

I am using regexp_like and I have a search string that will find nine consecutive digits and nine digits with dashes in them.

Here is that string: '[0-9]{9}$|^[0-9]{3}-[0-9]{2}-[0-9]{4}$'

Now, I need to add to this string to tell it to find Alpha Numeric also....

I have seen regexp examples like this:

SELECT *

FROM test

WHERE REGEXP_LIKE(testcol, '[[:alnum:]]');

SELECT *

FROM test

WHERE REGEXP_LIKE(testcol, '[[:alnum:]]{3}');

SELECT *

FROM test

WHERE REGEXP_LIKE(testcol, '[[:alnum:]]{5}');

These examples above bring back things like "letters" (a-z) that has no numbers in them, they make the search to broad.

My question is how do I add the [[:alnum:]] to theĀ  '[0-9]{9}$|^[0-9]{3}-[0-9]{2}-[0-9]{4}$' and it find different combinations of 12,13,9,8 and 6 Alpha Numeric numbers.

Thanks

This post has been answered by Boneist on Jan 9 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 7 2014
Added on Jan 8 2014
47 comments
2,896 views