Oracle基础教程:单行函数—正则表达式函数
正则表达式函数 (10g引入)
regexp_like('S','RE','O')
S 被搜索的字符串或者列表达式
RE 正则内容
O 参数(可选)
idle> select ename from emp where regexp_like(ename,'S');
ENAME
----------
SMITH
JONES
SCOTT
ADAMS
JAMES
idle> select ename from emp where regexp_like(ename,'^S.*T');
ENAME
----------
SMITH
SCOTT
idle>
idle> select ename from emp where regexp_like(ename,'^s.*T$','i');忽略大小写
ENAME
----------
SCOTT
idle>
regexp_replace(S,'RE','NEW')
idle> select ename,regexp_replace(ename,'S..T','=') aaa from emp where regexp_like (ename,'S..T');
ENAME AAA
---------- ----------
SMITH =H
SCOTT =T
idle>
regexp_replace(S,'RE','NEW')
idle> select ename,regexp_replace(ename,'S.*T','=') aaa from emp where regexp_like (ename,'S.*T');
ENAME AAA
---------- ----------
SMITH =H
SCOTT =
idle>