Luis,
This works for me:
select regexp_substr ('Param1 "Param2 Param3" "param4" param5
param6','(\"[^\"]*\")|([[:graph:]]+)', 1, rownum) Parameter
from dual
connect by regexp_substr ('Param1 "Param2 Param3" "param4" param5
param6','(\"[^\"]*\")|([[:graph:]]+)', 1, rownum) is not null
PARAMETER
---------
Param1
"Param2 Param3"
"param4"
param5
param6
It is what you had, but it will also match on anything (including spaces) that
are surrounded by double quotes.
For the record, I am not a regular expression expert either (by Internet
standards).
Matt
From: oracle-l-bounce@xxxxxxxxxxxxx <oracle-l-bounce@xxxxxxxxxxxxx> On Behalf
Of Luis Santos
Sent: Thursday, August 22, 2019 3:16 PM
To: ORACLE-L <oracle-l@xxxxxxxxxxxxx>
Subject: Help need using
CAUTION: This email has originated from outside of SOA. Do not click on links
or open attachments unless you recognize the sender and know the content is
safe.
Hello list!
First forgive me for not digging into documentation, but I'm not a regular
expression expert.
I need to perform a simple string parse, to get parameters separeted by white
space (or tabs) with unknown count.
I reached to this:
SQL> select regexp_substr ('Param1 Param2 Param3','[[:graph:]]+', 1, rownum)
Parameter
2 from dual
3 connect by level <= 3
4 /
PARAMETER
--------------------------------------------------------------------------------
Param1
Param2
Param3
But I need to consider, in special case, a group of words, enclosed with double
quotes, as a single parameter.
But, of course, this will not work:
SQL> select regexp_substr ('Param1 "Param2 Param3"','[[:graph:]]+', 1,
rownum) Parameter
2 from dual
3 connect by level <= 3
4 /
PARAMETER
----------------------------------------------------------------------------------------
Param1
"Param2
Param3"
How can I get the following output:
PARAMETER
----------------------------------------------------------------------------------------
Param1
"Param2 Param3"
Best regards,
Luis Santos
[https://lh3.googleusercontent.com/-AD-URpt0jeE/AAAAAAAAAAI/AAAAAAAB-9c/LrffscVVpf8/s90-c-k/photo.jpg]