Hi,
I am using REGEXP to search through an Oracle listing. At some point
in the listing I have some several lines of in-line comments. The
comments might not be had up against the left margin, so there may be
some leading spaces (this is what is tripping me up).
This regexp_instr gives me 83 (correct):
-- I want to find the next newline that is NOT followed by '--' (may
have some whitespace too).
select regexp_instr( 'BEGIN
-- DEVELOPMENT HISTORY
-- Original author: x
-- Creation date: y
-- CR z
v_user varchar2(30) := USER;
', '^[\t\x20]*?[^-{2}]', 13, 1, 0, 'm' )
from dual;
...but this one gives me 33 (i have added 9 spaces, so I want 93):
-- I want to find the next newline that is NOT followed by '--' (may
have some whitespace too).
select regexp_instr( 'BEGIN
-- DEVELOPMENT HISTORY
-- Original author: x
-- Creation date: y
-- CR z
v_user varchar2(30) := USER;
', '^[\t\x20]*?[^-{2}]', 13, 1, 0, 'm' )
from dual;
The regexp I have at the moment is:
^ - start of line
[\t\x20]*? - tab or space, zero or more, non-greedy
[^--[2]] - anything except '--'
The difference is the space at the start line '-- Original author...';
if I take all the leading spaces away from the comments, it correctly
matches the line starting 'v_user'.
I've tried [ ]*?, [\x20]*?, [\s]*?, omitting the '?' etc. nothing
makes any difference.
I'm about to try this in Perl. I can't report it as a bug in Oracle
until I observe a regexp actually working. I have tried for a long
time with this, but cannot get I even think there may be a bug in the
Oracle implementation of regexp!
Can anybody here see something that I'm obviously doing wrong?
Thanks for your help!
--
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