ORACLE: OCA-047-question and experiment (7)-regexp_replace usage

Source: Internet
Author: User

Question:

Answer: give two examples to understand

Example 1:

SQL> select phone_number,  2  REGEXP_REPLACE(t.phone_number,'([[:digit:]]{3})\.([[:digit:]]{3})\.([[:digit:]]{4})',  3  '(\1)\2-\3') "PHONE_NUMBER"  4  from employees t; PHONE_NUMBER         PHONE_NUMBER-------------------- --------------------------------------------------------------------------------515.123.4567         (515)123-4567515.123.4568         (515)123-4568515.123.4569         (515)123-4569590.423.4567         (590)423-4567590.423.4568         (590)423-4568590.423.4569         (590)423-4569

Example 2:

SQL> select phone_number,  2  REGEXP_REPLACE(t.phone_number,'([[:digit:]]{3})\.([[:digit:]]{3})\.([[:digit:]]{4})',  3  '(\2)\1-\3') "PHONE_NUMBER"  4  from employees t; PHONE_NUMBER         PHONE_NUMBER-------------------- --------------------------------------------------------------------------------515.123.4567         (123)515-4567515.123.4568         (123)515-4568515.123.4569         (123)515-4569590.423.4567         (423)590-4567590.423.4568         (423)590-4568

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.