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 help

km1612Nov 20 2020

Hi,
I am using REGEXP_LIKE to validate an expression as below.
select 'X' from dual
where regexp_like( 'CM2 4BB', '^[[:alpha:]]{1,2}[[:digit:]]{1,2}[[:space:]]{1}[[:digit:]]{1}[A-H,P-Z]{1,2}') ;
Basically second half of my expression can contain one or two letters excluding letters I-O.
The expression works ok for CM2 4IB, CM2 4I, CM2 4B ,CM2 4BI,CM2 4BB but it fails for CM2 4BI .
I have tried changing the expression to '^[[:alpha:]]{1,2}[[:digit:]]{1,2}[[:space:]]{1}[[:digit:]]{1}[A-H,P-Z]{0,2}') and '^[[:alpha:]]{1,2}[[:digit:]]{1,2}[[:space:]]{1}[[:digit:]]{1}[A-H,P-Z]{1}[A-H,P-Z]{1,2}') but hasn't helped and it is breaking other expressions which were evaluating OK.
Any help to solve this?
Thanks
K

This post has been answered by Solomon Yakobson on Nov 20 2020
Jump to Answer
Comments
Post Details
Added on Nov 20 2020
8 comments
1,789 views