Hi
I can't figure out owa pattern. I've read the docs and googled, but I can't figure it out.
As part of my algorithm, I want to examine a string using regular expressions, and for each match, extract the match (ie extract the substring). I don't think either of the owa_pattern subprograms, match or amatch, allow me to do this.
This is the proc I have been using to test
Running exec TestRegExp('Hello my name is mark', '\w+')
I would expect to get
Hello
my
name
is
mark
but what I actually get is
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at "EOAIACD.TESTREGEXP", line 14
ORA-06512: at line 1
How can I access each match in the string?
Thanks for any advice -
BTW - I have considered Java, but I thought this would be easier.
Mark![[openup] [openup] [openup]](/data/assets/smilies/openup.gif)
I can't figure out owa pattern. I've read the docs and googled, but I can't figure it out.
As part of my algorithm, I want to examine a string using regular expressions, and for each match, extract the match (ie extract the substring). I don't think either of the owa_pattern subprograms, match or amatch, allow me to do this.
This is the proc I have been using to test
Code:
create or replace procedure TestRegExp (pString in varchar2, pPattern in varchar2)
as
ThePattern owa_pattern.pattern;
TheOccurences owa_text.vc_arr;
iCounter integer;
TextPointer integer;
bFound boolean;
begin
TextPointer := 0;
loop
TextPointer := owa_pattern.amatch(pString, TextPointer, pPattern, TheOccurences);
exit when TextPointer = 0;
dbms_output.put_line(TheOccurences(1));
end loop;
end;
/
Running exec TestRegExp('Hello my name is mark', '\w+')
I would expect to get
Hello
my
name
is
mark
but what I actually get is
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at "EOAIACD.TESTREGEXP", line 14
ORA-06512: at line 1
How can I access each match in the string?
Thanks for any advice -
BTW - I have considered Java, but I thought this would be easier.
Mark
![[openup] [openup] [openup]](/data/assets/smilies/openup.gif)