Oracle的REGEXP_SUBSTR函数简单用法详解数据库
2023-06-13 09:20:09 时间
REGEXP_SUBSTR延伸SUBSTR函数的功能,让你搜索一个正则表达式模式字符串。
这也类似于REGEXP_INSTR,而是返回子字符串的位置,它返回的子字符串本身。
Oracle数据库中的REGEXP_SUBSTR函数的语法是:
REGEXP_SUBSTR(source_char, pattern [, position [, occurrence [, match_parameter ]]])source_char
搜索字符串。可以是任意的数据类型char,VARCHAR2,nchar,CLOB,NCLOB类型
pattern正则表达式
Matches the beginning of a string. If used with a match_parameter of ‘m’, it matches the start of a line anywhere within expression.
Matches the end of a string. If used with a match_parameter of ‘m’, it matches the end of a line anywhere within expression.
Used to specify a matching list where you are trying to match any one of the characters in the list.
Used to specify a nonmatching list where you are trying to match any character except for the ones in the list.
n is a number between 1 and 9. Matches the nth subexpression found within ( ) before encountering /n.
Matches the beginning of a string or matches at the end of a string before a newline character.
position
可选。搜索在字符串中的开始位置。如果省略,默认为1,这是第一个位置的字符串。
occurrence可选。它是模式字符串中的第n个匹配位置。如果省略,默认为1。
match_parameter可选。它允许你修改regexp_substr功能匹配的行为。它可以是以下的组合:
Allows the period character (.) to match the newline character. By default, the period is a wildcard.
expression is assumed to have multiple lines, where ^ is the start of a line and $ is the end of a line, regardless of the position of those characters in expression. By default, expression is assumed to be a single line.
Whitespace characters are ignored. By default, whitespace characters are matched like any other character.
找出匹配的数字
SELECT REGEXP_SUBSTR (hello my phone is 520 , [0-9]+) FROM dual; --520
下面这个例子返回指定第三次出现的字符
SELECT REGEXP_SUBSTR (i like beijing tiananmen, (/S*)(/s), 1, 3) FROM dual; --beijing
作者:itmyhome
4104.html
oracle相关文章
- Oracle警报:谨慎观察文件(oracle警告文件)
- 管理Oracle数据库用户权限的策略(oracle用户权限设置)
- 时连接Oracle数据库:空闲时空反应(oracle连接到空闲)
- 深入理解Oracle数据库中触发器类型(oracle触发器类型)
- 学习Oracle数据库中的触发器类型(oracle触发器类型)
- 安装Oracle数据库客户端的指南(安装oracle客户端)
- Oracle数据库中的月份英文简述(oracle月份英文)
- 比较DB2与Oracle数据库的差异(db2与oracle)
- 遍历Oracle数组,收获更大的惊喜!(oracle数组遍历)
- 简单易学的Oracle触发器删除方法(oracle删除触发器)
- 定关闭Oracle数据库:解除锁定(关闭oracle锁)
- Oracle数据库中如何修改颜色?(oracle颜色)
- Oracle数据库教程:快速创建表和添加用户(oracle创建表用户)
- 深入解析Oracle字段设计技巧(oracle字段设计)
- VB程序如何实现远程连接Oracle数据库(vb远程连接oracle)
- Oracle左外连接技术极大提升数据库查询效率(oracle左外连接)
- Oracle数据库内存用尽解决方案(oracle 内存用尽)
- Oracle全面恢复复苏希望的灯塔(oracle全部恢复)
- LDAP搭建Oracle数据库访问权限(ldap连接oracle)
- 是oracle深入认识Oracle一款多功能的数据库管理系统(oracle 什么)
- 深入探讨Oracle数据库自增主键的不足之处(oracle主键自增缺点)
- 数据洞察Oracle中的外部关联分析(oracle中外关联)
- Oracle中的元数据存储把握至关重要的数据结构(oracle中元数据存储)
- Oracle MD030实现企业数据的全面优化(oracle md030)