I think I've cracked it. just for posterity, this seems to work:
declare
v_source clob := 'BEGIN
-- DEVELOPMENT HISTORY
-- Original author: x
-- Creation date: y
-- CR z
v_user varchar2(30) := USER;
v_sysdate date := sysdate;
';
v_pattern varchar2(18) := '^[\t ]*[^- ]{2}.*$';
v_instr number;
v_substr varchar2(100);
begin
select '^'||regexp_substr( v_source, v_pattern, 1, 2, 'm' )||'$'
v_substr,
regexp_instr( v_source, v_pattern, 1, 2, 0, 'm' )
v_instr
into v_substr, v_instr
from dual;
dbms_output.put_line('v_substr='||v_substr); -- v_substr=^ v_user
varchar2(30) := USER;$
dbms_output.put_line('v_instr='||to_char(v_instr)); -- v_instr=86
end;
The secret was Oracle (up to 11 at least) uses the POSIX regular
expression standard (documented at
http://pubs.opengroup.org/onlinepubs/007908799/xbd/re.html).
Work from that document. Oracle regexp doesn't use newer constructs
like (?!--) etc.
On Aug 2, 1:44 pm, VTR250 <[email protected]> wrote:
> Just to update you all on this:
>
> I have come up with a regex in Python that does what I want but I
> still can't get the same regex patten to work in Oracle.
>
> <snip>
--
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en