Using Oracle 12c, how can I use regexp_substr to separate a tab delimited record whose fields may contain spaces? The record has four fields. The third field contains words with spaces.
I'm using this as my reference:Oracle Regex
Here's my query
with tab_delimited_record as
(select 'Field1 Field2 This is field3 and contains spaces Field4' as record_with_fields from dual)
select record_with_fields,
regexp_substr('\S+',1,3) as field3a, -- Expect ==>This is field3...
regexp_substr('\t+',1,3) as field3b, -- Expect==>This is field3...
regexp_substr('[[::space::]]+',1,3) as field_3c -- Another version
from tab_delimited_record
Desired Results
RECORD_WITH_FIELDS
Field1 Field2 This is field3 and contains spaces Field4
FIELD3
This is field3 and contains spaces