OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database

SQL - V4.2.2

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & Certification
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V4.2.2
    iconOceanBase Database
    SQL - V 4.2.2
    SQL
    KV
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    REGEXP_REPLACE

    Last Updated:2026-04-15 08:27:15  Updated
    share
    What is on this page
    Purpose
    Syntax
    Parameters
    Return type
    Examples

    folded

    share

    Purpose

    REGEXP_REPLACE() replaces characters in source_char that match a regular expression with characters in replace_string.

    Syntax

    REGEXP_REPLACE(source_char, pattern
                     [, replace_string
                        [, position
                          [, occurrence
                            [, match_param ]
                          ]
                        ]
                     ]
                   )
    

    Parameters

    Parameter Description
    source_char A character expression that serves as the search value. It is usually a character column It can be of the CHAR, VARCHAR2, NCHAR, NVARCHAR2, or CLOB data type.
    pattern The regular expression. It is usually a text literal and can be of the CHAR, VARCHAR2, NCHAR, or NVARCHAR2 data type.
    replace_string The replacement string. It can be of the CHAR, VARCHAR2, NCHAR, NVARCHAR2, or CLOB data type.
    position The position where the function begins searching for a match. This optional parameter is a positive integer. The default value is 1, which means that the function begins searching at the first character of source_char.
    occurrence A non-negative integer that specifies the occurrence to be replaced.
    • If you specify 0, OceanBase Database replaces all occurrences of the match.
    • If you specify a positive integer n, OceanBase Database replaces the nth occurrence.
    match_param A character expression of the VARCHAR2 or CHAR data type. This parameter allows you to change the default matching behavior of the function.
    • i indicates case-insensitive matching.
    • c indicates case-sensitive matching.
    • n allows the period (.) to match the newline character.
    • m assumes that the source string has multiple lines.
    • x ignores whitespace characters. By default, whitespace characters match each other.

    Return type

    The return type is the same as the data type of source_char.

    Examples

    The following example replaces, with *, all characters in OCEANBASE database that match (A|B){1}.

    obclient> SELECT REGEXP_REPLACE('OCEANBASE database', '(A|B){1}', '*',1,0) AS "REGEXP_REPLACE" FROM DUAL;
    +--------------------+
    | REGEXP_REPLACE     |
    +--------------------+
    | OCE*N**SE database |
    +--------------------+
    1 row in set
    

    Previous topic

    NLS_UPPER
    Last

    Next topic

    REGEXP_SUBSTR
    Next
    What is on this page
    Purpose
    Syntax
    Parameters
    Return type
    Examples