select Val,
case when owa_pattern.amatch(Val,1,'AB?C+D+E') = 0
then 'UnMatch' else 'Match' end as IsMatch
from (select 'A' as Val from dual
union all select 'AB' from dual
union all select 'ABC' from dual
union all select 'ABCD' from dual
union all select 'ABCDE' from dual
union all select 'ABCDEF' from dual);
VAL ISMATCH
------ -------
A UnMatch
AB UnMatch
ABC UnMatch
ABCD UnMatch
ABCDE Match
ABCDEF Match
■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
declare
str1 varchar2(4000) := 'ABACABACADAE';
str2 varchar2(4000) := 'ABACABACADAE';
str3 varchar2(4000) := 'AAAAABBB';
str4 varchar2(4000) := 'ABACABACADAE';
begin
DBMS_Output.Put_Line(OWA_PATTERN.CHANGE(str1,'A[A-Z]+',null,'g'));
DBMS_Output.Put_Line(nvl(str1,'nullです'));
DBMS_Output.Put_Line(OWA_PATTERN.CHANGE(str2,'A[B-Z]+',null,'g'));
DBMS_Output.Put_Line(nvl(str2,'nullです'));
DBMS_Output.Put_Line(OWA_PATTERN.CHANGE(str3,'A+','C','g'));
DBMS_Output.Put_Line(nvl(str3,'nullです'));
DBMS_Output.Put_Line(OWA_PATTERN.CHANGE(str4,'A[B-D]',null,'g'));
DBMS_Output.Put_Line(str4);
end;
/
1
nullです
6
nullです
1
CBBB
5
AE