RE: Help need using

From: McPeak, Matt (Consultant) <"McPeak,>
Date: Fri, 23 Aug 2019 21:03:39 +0000
Message-ID: <BL0PR04MB4467F1D836F5BB72F21526C7DDA40_at_BL0PR04MB4467.namprd04.prod.outlook.com>



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_at_freelists.org <oracle-l-bounce_at_freelists.org> On Behalf Of Luis Santos Sent: Thursday, August 22, 2019 3:16 PM To: ORACLE-L <oracle-l_at_freelists.org> 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]

--
http://www.freelists.org/webpage/oracle-l
Received on Fri Aug 23 2019 - 23:03:39 CEST

Original text of this message