Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

1.8. Regular Expression Quick Reference > \1 through \9 (Backslash)

Name

\1 through \9 (Backslash) — References the value matchedby a preceding subexpression

Synopsis

Use \1, \2, \3, etc. through \9 to create backreferences to values matched by preceding subexpressions. You can backreference up to nine subexpressions, the first nine, in any expression. Subexpressions are numbered in the order in which their opening parentheses are encountered when scanning from left to right.

For example, to flip a name from last, first format to first last:

SELECT REGEXP_REPLACE(
   'Sears, Andrew',
   '(.+), (.+)','\2 \1')
FROM dual;

Andrew Sears

For more examples, see Section 1.6.8 in Section 1.6 and REGEXP_REPLACE under Section 1.9.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint