Oracle Regular Expression

Source: Internet
Author: User

[Guide] Using regular expressions in Oracle requires the following four functions:

Oracle uses regular expressions without these four functions:

1. Regexp_like

2. Regexp_substr

-- Select regexp_substr ('aaa, BB, CCCCC, DDD, vvv ',' [^,] + ', 1, 4) from dual

3. Regexp_instr

4. Regexp_replace

 

Parameters

1. Source_char: the input string, which can be a column name, A String constant, or a variable.

2. Pattern, a regular expression.

3. Match_parameter, matching option.

Value Range: I (Case Insensitive), C (case sensitive), and N (point number. do not match line feed characters; M: multi-line mode; X: Extended Mode. Ignore the blank characters in the regular expression.

4. Position, which indicates the regular expression matching starting from the nth character.

5. Occurrence, which identifies the matching groups.

6. Replace_string, the replacement string.

 

Example:

Select STR from TMP where id = 'like' and regexp_like (STR, 'a \ D + ',' I '); --' I 'case insensitive

Regexp_substr (STR, '[^,] + ')

Regexp_instr ('192. 168.0.1 ',' \ d', 1, level) IND -- position of each number

Regexp_replace (STR, '020', 'gz ') STR,

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.