Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

owa_pattern help

Status
Not open for further replies.

Custom24

Programmer
Nov 27, 2001
591
GB
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

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]
 
Mark,

I, too, am unschooled in anything "owa...". But if know the behaviour/output you want from a particular input, I'm sure we can build you a solution. Let us know the specs,

[santa]Mufasa
(aka Dave of Sandy, Utah, USA @ 01:09 (16Sep04) UTC (aka "GMT" and "Zulu"), 18:09 (15Sep04) Mountain Time)
 
I love regular expressions. I really wanted to do this using a regular expression engine. But I have really trawled Google and metalink and orafaq, and the owa_pattern package has one doc and about ten examples on the entire net. Some of the examples do not work properly. So I am going to give up on this for now.

There are also a couple of posts on Metalink where people have asked pretty much the same question I asked here, but there was no satisfactory reply.

Thanks for your reply, though.

Mark [openup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top