oracle sql 正则表达式
生活随笔
收集整理的這篇文章主要介紹了
oracle sql 正则表达式
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
備注:
詳細直接看注釋就好
介紹了sql的正則使用
sql:
--9.正則 --REGEXP_LIKE, REGEXP_REPLACE --REGEXP_INSTR, REGEXP_SUBSTR--.匹配任意單個字符 /* select prod_name from products where regexp_like(prod_name, '.000') order by prod_name */--執行or操作 /* select prod_name from products where regexp_like(prod_name, '1000|2000') order by prod_name */--匹配多個字符之一[] /* select prod_name from products where regexp_like(prod_name, '[123] ton') order by prod_name */--^對字符集取反 /* select prod_name from products where regexp_like(prod_name, '[^123] ton') order by prod_name */--‘-'表示范圍 /* select prod_name from products where regexp_like(prod_name, '[1-5] ton') order by prod_name */--轉義匹配特殊字符 /* select vend_name from vendors where regexp_like(vend_name, '\.') order by vend_name */--匹配字符類別 -- \d任意數字,\D任意非數字,\w任意字母or數字 -- \W任意非字母或數字[^a-zA-Z0-9],\s任意空白,\S任意非空白-- 重復元字符 -- *:0或多 -- +: 1或多 -- ?: 0或1 -- {n}:具體多次 -- {n,}: 大于等于n次 -- {n,m}: 范圍搜索--?的對象是s /* select prod_name from products where regexp_like(prod_name, '\(\d sticks?\)') order by prod_name */-- \d{4}表示匹配四個 /* select prod_name from products where regexp_like(prod_name, '\d{4}') order by prod_name */--錨 -- ^文本的開頭 -- $文本的結尾select prod_name from products where regexp_like(prod_name, '^[0-9\.]') order by prod_name--regexp_like + ^ + $ = like總結
以上是生活随笔為你收集整理的oracle sql 正则表达式的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 李宏毅机器学习 之 机器学习介绍(一)
- 下一篇: [机器学习入门] 经典台大李宏毅机器学习