重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 4585|回复: 2
打印 上一主题 下一主题

【课堂笔记】【SQL】19.Regular Expression Support

[复制链接]
跳转到指定楼层
楼主
发表于 2012-11-6 10:42:58 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

正则符号集:

 

Symbol

Description

*

Matches zero or more occurrences

|

Alteration operator for specifying alternative matches

 ^/$

Matches the start-of-line/end-of-line

[ ]

Bracket expression for a matching list matching any one of the expressions represented in the list

{m}

Matches exactly m times

{m,n}

Matches at least m times but no more than n times

[: :]

Specifies a character class and matches any character in that class

\

Can have 4 different meanings: 1. Stand for itself. 2. Quote the next character. 3. Introduce an operator. 4. Do nothing.

+

Matches one or more occurrences

?

Matches zero or one occurrence

.

Matches any character in the supported character set, except NULL

()

Grouping expression, treated as a single subexpression

[==]

Specifies equivalence classes

\n

Back-reference expression

[..]

Specifies one collation element, such as a multicharacter element

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

沙发
 楼主| 发表于 2012-11-6 10:44:25 | 只看该作者

正则函数集:

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]]]])

回复 支持 反对

使用道具 举报

板凳
 楼主| 发表于 2012-11-6 10:53:30 | 只看该作者

示例:

SQL> select first_name,last_name from employees
  2  where regexp_like (first_name,'^Ste(v|ph)en$');

FIRST_NAME           LAST_NAME
-------------------- -------------------------
Steven               King
Steven               Markle
Stephen              Stiles

 

SQL> select street_address,regexp_instr(street_address,'[^[:alpha:]]') from locations where regexp_instr(street_address,'[^[:alpha:]]')>1;

STREET_ADDRESS
----------------------------------------
REGEXP_INSTR(STREET_ADDRESS,'[^[:ALPHA:]]')
-------------------------------------------
Magdalen Centre, The Oxford Science Park
                                          9

Schwanthalerstr. 7031
                                         16

Rua Frei Caneca 1360
                                          4


STREET_ADDRESS
----------------------------------------
REGEXP_INSTR(STREET_ADDRESS,'[^[:ALPHA:]]')
-------------------------------------------
Murtenstrasse 921
                                         14

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-11-16 12:57 , Processed in 0.091428 second(s), 21 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表