469,315 Members | 1,795 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Share your developer knowledge by writing an article on Bytes.

10g REGULAR EXPRESSIONS (REGEXP_SUBSTR)

amitpatel66
2,367 Expert 2GB
REGEXP_SUBSTR

The REGEXP_SUBSTR function, much like the SUBSTR function, extracts part of a string

Syntax:

REGEXP_SUBSTR(source_string, pattern[, position [, occurrence[, match_parameter]]])

Example:

In the following SQL query, the string that matches the pattern , [^,]*, is returned. The regular expression searches for a comma followed by a space; then zero or more characters that are not commas, as indicated by [^,]*; and lastly looks for another comma. The pattern will look somewhat similar to a comma-separated values string.

Expand|Select|Wrap|Line Numbers
  1. SELECT REGEXP_SUBSTR('first field, second field , third field',
  2.        ', [^,]*,') reg_substr
  3.   FROM dual
  4.  
  5. REG_SUBSTR
  6. ------------------
  7. , second field   ,
  8.  
Oct 9 '07 #1
0 12186

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Sehboo | last post: by
4 posts views Thread by Egyd Csaba | last post: by
7 posts views Thread by Billa | last post: by
3 posts views Thread by a | last post: by
25 posts views Thread by Mike | last post: by
13 posts views Thread by Wiseman | last post: by
12 posts views Thread by FAQEditor | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.