469,267 Members | 1,059 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_REPLACE)

amitpatel66
2,367 Expert 2GB
REGEXP_REPLACE

This function replaces the matching pattern with a specified replace_string, allowing complex search-and-replace operations.

Syntax:

REGEXP_REPLACE(source_string, pattern[, replace_string [, position[,occurrence, [match_parameter]]]])

Example:

The following query replaces any two or more spaces with a single space. The ( ) subexpression contains a single space, which can be repeated two or more times, as indicated by {2,}.

Expand|Select|Wrap|Line Numbers
  1. SELECT REGEXP_REPLACE('Joe   Smith',
  2.        '( ){2,}', ' ')
  3.        AS RX_REPLACE
  4.   FROM dual
  5.  
  6. RX_REPLACE
  7. ----------
  8. Joe Smith 
  9.  
Oct 9 '07 #1
0 9986

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
By using this site, you agree to our Privacy Policy and Terms of Use.