After the useful answers on my previous question (see How do I create a regex to avoid a repeated number with optional hyphen?) we reached a solution that matched my needings.
The final result was:
^(?!(\d)(?:-?\1)*$)\d{2}-?\d{7}$
The above regex excludes these data:
- 00-0000000 and 000000000
- 11-1111111 and 111111111
- 22-2222222 and 222222222
- ...
- 99-9999999 and 999999999
Note that 22-2222221 is valid.
Note also that the position of the hyphen can be anywhere after the first digit and before the last one
Now that everything seemd to work fine we noticed that this pattern is not compatible with the oracle database REGEXP LIKE command.
Any suggestion on how to adapt it? Thanks in advance.
I read here Oracle regular expression replacement for negative lookahead/lookbehind and the solution provided doesn't seem to work for me.