Re: Regular expression problem
From: Vladimir M. Zakharychev <vladimir.zakharychev_at_gmail.com>
Date: Fri, 13 Feb 2009 00:21:35 -0800 (PST)
Message-ID: <65084944-b246-451b-80e7-4f68b319df98_at_33g2000yqm.googlegroups.com>
On Feb 12, 12:57 pm, mattst..._at_hotmail.it wrote:
> I beg you pardon:
>
> The correct code I used is the following (note the missing double
> backslash).
>
> begin
> if owa_pattern.match(
> 'library\source\jtoru436.pxe',
> '(source|include)\\jtor.*436[.].*')
> then
> dbms_output.put_line('Found');
> else
> dbms_output.put_line('NOT FOUND');
> end if;
> end;
>
> The point is that matching with '(source)\\jtor.*436[.].*' returns
> "Found" !
>
> On 12 Feb, 10:51, mattst..._at_hotmail.it wrote:
>
> > I'm using Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit
> > Production With the Partitioning option JServer Release 9.2.0.7.0 -
> > Production.
>
> > I'm in trouble using owa_pattern Oracle standard package.
>
> > Trying the following block:
> > begin
> > if owa_pattern.match(
> > 'library\\source\\jtoru436.pxe',
> > '(source|include)\\jtor.*436[.].*')
> > then dbms_output.put_line('Found');
> > else dbms_output.put_line('NOT FOUND');
> > end if;
> > end;
>
> > the output is "NOT FOUND".
>
> > The equivalent code written in Perl:
>
> > print "Found" if 'library\\source\\jtoru436.pxe' =~ m/(source|
> > include)\\jtor.*436[.].*/;
>
> > returns "Found".
>
> > What should I think about owa_pattern.match package ?
>
> > Matt.
>
>
OR
THEN ... Hth,
Date: Fri, 13 Feb 2009 00:21:35 -0800 (PST)
Message-ID: <65084944-b246-451b-80e7-4f68b319df98_at_33g2000yqm.googlegroups.com>
On Feb 12, 12:57 pm, mattst..._at_hotmail.it wrote:
> I beg you pardon:
>
> The correct code I used is the following (note the missing double
> backslash).
>
> begin
> if owa_pattern.match(
> 'library\source\jtoru436.pxe',
> '(source|include)\\jtor.*436[.].*')
> then
> dbms_output.put_line('Found');
> else
> dbms_output.put_line('NOT FOUND');
> end if;
> end;
>
> The point is that matching with '(source)\\jtor.*436[.].*' returns
> "Found" !
>
> On 12 Feb, 10:51, mattst..._at_hotmail.it wrote:
>
> > I'm using Oracle9i Enterprise Edition Release 9.2.0.7.0 - 64bit
> > Production With the Partitioning option JServer Release 9.2.0.7.0 -
> > Production.
>
> > I'm in trouble using owa_pattern Oracle standard package.
>
> > Trying the following block:
> > begin
> > if owa_pattern.match(
> > 'library\\source\\jtoru436.pxe',
> > '(source|include)\\jtor.*436[.].*')
> > then dbms_output.put_line('Found');
> > else dbms_output.put_line('NOT FOUND');
> > end if;
> > end;
>
> > the output is "NOT FOUND".
>
> > The equivalent code written in Perl:
>
> > print "Found" if 'library\\source\\jtoru436.pxe' =~ m/(source|
> > include)\\jtor.*436[.].*/;
>
> > returns "Found".
>
> > What should I think about owa_pattern.match package ?
>
> > Matt.
>
>
OWA_PATTERN is not a full-fledged RE processor. In particular, it does not support "or" matching, even in 10gR2, exactly what you're seeing. REGEXP_xxx group of functions is not yet available in 9.2. You can therefore only OR the two calls yourself:
IF owa_pattern.match(
'library\source\jtoru436.pxe', 'source\\jtor.*436[.].*')
OR
owa_pattern.match(
'library\source\jtoru436.pxe', 'include\\jtor.*436[.].*')
THEN ... Hth,
Vladimir M. Zakharychev
N-Networks, makers of Dynamic PSP(tm)
http://www.dynamicpsp.com
Received on Fri Feb 13 2009 - 02:21:35 CST