Oracle正则表达式函数详解
Oracle 10g提供了四个正则表达式函数regexp function: REGEXP_LIKE, REGEXP_REPLACE,REGEXP_INSTR,REGEXP_SUBSTR。
Oracle 10g提供了四个正则表达式函数regexp function: REGEXP_LIKE, REGEXP_REPLACE,REGEXP_INSTR,REGEXP_SUBSTR。
REGEXP_LIKE:(匹配) 比较一个字符串是否与正则表达式匹配
(srcstr, pattern [, match_option])
REGEXP_INSTR:(包含)在字符串中查找正则表达式,并且返回匹配的位置
(srcstr, pattern [, position [, occurrence [, return_option [, match_option]]]])
REGEXP_SUBSTR:(提取) 返回与正则表达式匹配的子字符串
(srcstr, pattern [, position [, occurrence [, match_option]]])
REGEXP_REPLACE:(替换)搜索并且替换匹配的正则表达式
(srcstr, pattern [, replacestr [, position [, occurrence [, match_option]]]])
srcstr: 被查找的字符数据。
pattern: 正则表达式。
occurrence: 出现的次数。默认为1。
position: 开始位置
return_option: 默认值为0,返回该模式的起始位置;值为1则返回符合匹配条件的下一个字符的起始位置。
replacestr: 用来替换匹配模式的字符串。
match_option: 匹配方式选项。缺省为c。
c:case sensitive
I:case insensitive
n:(.)匹配任何字符(包括newline)
m:字符串存在换行的时候被作为多行处理
##################################################################################
正则表达式由以下标准的元字符(metacharacters)所构成: 字符[[:alpha:]]任何字母。[A-Za-z]
[[:digit:]]任何数字。[0-9]
[[:alnum:]]任何字母和数字。[A-Za-z0-9]
[:blank:] [ ],标准是空格和TAB,但Oracle里只有空格!
[:cntrl:] CONTROL键
[:graph:] 即所有可见字符,不包括空格
[:print:] 可打印字符 ,即空格+所有可见字符
[[:space:]] 空白字符。
[[:punct:]] 任何标点符号。
[[:upper:]] 任何大写字母。[A-Z]
[[:lower:]] 任何小写字母。[a-z]
[[:xdigit:]]任何16进制的数字,相当于[0-9a-fA-F]。
#######
[:class:] 字符类。class如alnum、digit等。
[.element.] 整理类。受NLS_SORT影响。将多字节字符当作单字节字符看待。如在西班牙语中ch、ll都是用多字节表示的单字节。
[=char=] 等同类。在当前语言(Locale)下,匹配所有的属于相同的POSIX等同类字符指定的字符。如在西班牙语中,,[[=n=]]指定了等同类字符n,它可以匹配El Ni?o中的N和 ?.
###########################################################################
^ 每一行的开头,单行模式下等价于字符串的开头
$ 每一行的结尾,单行模式下等价于字符串的结尾
在单行模式下,^和\A等价,$和\Z等价。
##########################################################################
* 匹配零次或多次--尽可能多的次数
? 零次或一次
+ 一次或多次
{m} {m}?正好m次,贪婪与非贪婪一样的
{m,} {m,}?至少m次
{m, n} {m, n}?最少m最多n次
在上述字符后加?,如:*?,即为非贪婪模式。
贪婪模式会获取尽可能多的字符,而非贪婪模式会获取尽可能少的字符
###############################################################
更多详情见请继续阅读下一页的精彩内容:
推荐阅读:
精通正则表达式(第3版) PDF高清中文版
Oracle函数之Replace()
Oracle函数大全
Oracle函数之case和decode的用法区别及性能比较
Oracle函数和存储过程简单实例

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)
