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!

+ regular expression operator in Oracle SQL

sabyakgpMar 5 2021

Hi - As per the Oracle documentation (database development guide) the + regular operator is described as follows:
Matches one or more occurrences of the preceding subexpression (greedy).
Example: The expression a+ matches the strings a, aa, and aaa, but does not match ba or ab.
But when I run the following SQL:
select 1 from dual where regexp_like ('ab','^a+');
Output: 1
I was expecting NULL as it's not 'aa' (the + operator should match for the preceding subexpression which is a).
Can someone please explain this behavior?

This post has been answered by mathguy on Mar 6 2021
Jump to Answer
Comments
Post Details
Added on Mar 5 2021
6 comments
582 views