目录一、正则表达式:1、REGEXP_LIKE :匹配2、REGEXP_REPLACE :替换3、REGEXP_INSTR :位置4、REGEXP_SUBSTR :提取5、R
从10g开始,可以在查询中使用
REGEXP_LIKE(source_string, pattern[, match_parameter]):返回满足匹配模式的字符串
相当于增强的like函数。
其中 match_parameter参数都是可选的。
match_parameter的取值如下:
REGEXP_REPLACE(source_string,pattern,replace_string,position,occurtence,match_parameter):字符串替换函数
相当于增强的replace函数。
select length(regexp_replace('123-345-566', '[^-]', '')) from dual;
REGEXP_INSTR(source_string, pattern[, start_position[, occurrence[, return_option[, match_parameter]]]])该函数查找 pattern ,并返回该模式的第一个位置。
您可以随意指定您想要开始搜索的 start_position。
SELECT REGEXP_INSTR ('hello itmyhome', 'e') FROM dual
REGEXP_SUBSTR(source_string, pattern[,position [, occurrence[, match_parameter]]]):返回匹配模式的子字符串。
相当于增强的substr函数。
其中position,occurtence,match_parameter参数都是可选的。
SELECT REGEXP_SUBSTR ('hello my phone is 520 ', '[0-9]+') FROM dual; --520
REGEXP_COUNT (source_char, pattern [, position [, match_parameter]])统计字符串出现的次数
select REGEXP_COUNT('123-345-566', '-') from dual;
[:alpha:]:字母字符
[:lower:]:小写字母字符
[:upper:]:大写字母字符
[:digit:]:数字
[:alnum:]:字母数字字符
[:space:]:空白字符(禁止打印),如回车符、换行符、竖直制表符和换页符
[:punct:]:标点字符
[:cntrl:]:控制字符(禁止打印)
[:print:]:可打印字符
--结束END--
本文标题: 在Oracle中使用正则表达式
本文链接: https://www.lsjlt.com/news/147987.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0