I am using a regex that works perfectly in Java/PHP/regex testers.
\\d(?:[()\\s#-]*\\d){3,}
Examples: https://regex101.com/r/oH6jV0/1
Oracle does not support non-capturing groups (?:)
. You will need to use a capturing group instead.
It also doesn't like the perl-style whitespace meta-character \s
match inside a character class []
(it will match the characters \
and s
instead of whitespace). You will need to use the POSIX expression [:space:]
instead.
SQL Fiddle
Oracle 11g R2 Schema Setup:
Query 1:
select *
from (
select column_value str
from table(sys.dbms_debug_vc2coll('123','1234','12345','12 135', '1', '12 3'))
)
where regexp_like(str, '\d([()[:space:]#-]*\d){3,}')
Results:
| STR |
|--------|
| 1234 |
| 12345 |
| 12 135 |