Connecting Tech Pros Worldwide Help | Site Map

10g REGULAR EXPRESSIONS (REGEXP_REPLACE)

  #1  
Old October 9th, 2007, 01:55 PM
amitpatel66's Avatar
Moderator
 
Join Date: Mar 2007
Location: Hyderabad, India
Posts: 2,188
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.  



Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
what are wild cards incase of sql hardeep1 answers 4 November 26th, 2007 05:40 AM
Oracle 10g Feature: REGULAR EXPRESSIONS - 1 amitpatel66 insights 0 October 9th, 2007 01:45 PM