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!

Oracle REGEXP_LIKE error? Why do these sql work differently?

Arpad KissJan 25 2024 — edited Jan 25 2024

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

I'm looking for strings with any number of letters followed by a point and at least one lowercase letter.
The sample is not like this ( 'H.T. Al' -there is a capital letter after the first point, and a space after the second ), but the first select indicates a hit. Why?

select 'XX' from dual where regexp_like ( 'H.T. Al','[A-Za-z]*\.[a-z]+' ,'c') ; The result: XX

If I replace 'T' with 'A', the result is null. This is total nonsense:

select 'XX' from dual where regexp_like ( 'H.A. Al','[A-Za-z]*\.[a-z]+','c' ) ; The result: null

select 'XX' from dual where regexp_like ( 'H.T. Al','[A-Za-z]*\.[[:lower:]]+','c' ) ; The result: null

This post has been answered by mathguy on Jan 25 2024
Jump to Answer
Comments
Post Details
Added on Jan 25 2024
9 comments
1,374 views