Q:

Oracle how to instr for tab or end of line using regexp_instr

I have the following code
declare
l_clob       clob;
l_line       varchar2(32767);
l_field      varchar2(32767);
l_line_start  pls_integer := 1;
l_line_end    pls_integer := 1;
l_field_start pls_integer := 1;
l_field_end   pls_integer := 1;
begin
   select response_clob
   into   l_clob
   from   xxhr.xxhr_web_service_response
   where  response_id = 290;
   -- Loop through lines.
   loop
      l_line_end := dbms_lob.instr(l_clob, chr(10), l_line_start, 1);
      l_line := dbms_lob.substr(l_clob, l_line_end - l_line_start + 1, l_line_start);
      -- If this is a line with fields and not web service garbage.
      if substr(l_line, 1, 1) = '"' then
         l_field_start := 2;
         -- Loop through fields.      
         loop
            l_field_end := instr(l_line, chr(9), l_field_start, 1);
            l_field := substr(l_line, l_field_start, l_field_end - l_field_start);  
            dbms_output.put(l_field || ',');
            l_field_start := l_field_end + 1;
            exit when l_field_end = 0;
         end loop;
         dbms_output.put_line('');         
      end if;   
      l_line_start := l_line_end + 1;
      exit when l_line_end = 0;
   end loop;
end;   

with which I'm trying to parse this clob test data:
﻿LINE_TEXT
"PERSON_ID_NUMBER   30000   1223445454"
"PERSON_DOB 30000   01-01-1900"

The clob data is tab separated and has a chr(10) at the end. I'm not familiar with regexp_instr, but currently I'm only using instr to search for the tab separators; so it's missing the end of line field and producing:
PERSON_ID_NUMBER,30000,,
PERSON_DOB,30000,,

How can I change the instr into a regexp_instr to also look for the end of line character in addition to the tab and then correctly pick up the last field?
I need the function to be performant, since it is parsing large files.

A:

Fixed it with:
declare
l_clob       clob;
l_line       varchar2(32767);
l_field      varchar2(32767);
l_line_start  pls_integer := 1;
l_line_end    pls_integer := 1;
l_field_start pls_integer := 1;
l_field_end   pls_integer := 1;
begin
   select response_clob
   into   l_clob
   from   xxhr.xxhr_web_service_response
   where  response_id = 290;
   -- Loop through lines.
   loop
      l_line_end := dbms_lob.instr(l_clob, chr(10), l_line_start, 1);
      l_line := dbms_lob.substr(l_clob, l_line_end - l_line_start + 1, l_line_start);
      -- If this is a line with fields and not web service garbage.
      if substr(l_line, 1, 1) = '"' then
         l_field_start := 2;
         -- Loop through fields.      
         loop
            l_field_end := instr(l_line, chr(9), l_field_start, 1);
            l_field := substr(l_line, l_field_start, l_field_end - l_field_start);  
            dbms_output.put(l_field || ',');
            exit when l_field_end = 0;
            l_field_start := l_field_end + 1;            
         end loop;
         l_field := substr(l_line, l_field_start);
         dbms_output.put_line(l_field);                           
      end if;   
      l_line_start := l_line_end + 1;
      exit when l_line_end = 0;
   end loop;
end;   

