Home » SQL & PL/SQL » SQL & PL/SQL » Using REGEXP_SUBSTR
Using REGEXP_SUBSTR [message #620211] Wed, 30 July 2014 02:37 Go to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi ,
SELECT
  REGEXP_SUBSTR('500 Oracle Parkway, Redwood Shores, CA',',[^,]+,')REGEXPR_SUBSTR
  FROM DUAL;
output is:
----------
, Redwood Shores,

SELECT
  REGEXP_SUBSTR('500 Oracle Parkway, Redwood Shores, CA,America',',[^,]+,')REGEXPR_SUBSTR
  FROM DUAL;

output is:
----------
, Redwood Shores,


[^,]+ -->Oracle Database searches for a comma followed by one or more occurrences of non-comma characters followed by a comma

can you please explain why i am getting same output here
Re: Using REGEXP_SUBSTR [message #620213 is a reply to message #620211] Wed, 30 July 2014 03:07 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Because nothing changed (as far as your regular expression is concerned).
Re: Using REGEXP_SUBSTR [message #620214 is a reply to message #620211] Wed, 30 July 2014 03:16 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
mist598 wrote on Wed, 30 July 2014 13:07

[^,]+ -->Oracle Database searches for a comma followed by one or more occurrences of non-comma characters followed by a comma

can you please explain why i am getting same output here



Is this what you were looking for in your second case?

SQL> SELECT regexp_substr('500 Oracle Parkway, Redwood Shores, CA,America',
  2                       ',[^,].+,') regexpr_substr
  3    FROM dual;
REGEXPR_SUBSTR
---------------------
, Redwood Shores, CA,


where, "." matches any character in the supported character set (except NULL)
Re: Using REGEXP_SUBSTR [message #620217 is a reply to message #620214] Wed, 30 July 2014 04:05 Go to previous message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Quote:
Is this what you were looking for in your second case?

Yes Thanks Lalit.. Smile
Previous Topic: need the output
Next Topic: REG_EXP csv and double quotes
Goto Forum:
  


Current Time: Fri Apr 26 22:22:59 CDT 2024