加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

[每日一题] OCP1z0-047 :2013-08-21 ? 正则表达式---REGEXP_INST

发布时间:2020-12-14 02:17:27 所属栏目:百科 来源:网络整理
导读:转载请注明出处:http://www.jb51.cc/article/p-vslmamwp-dk.html 650) this.width=650;" src="http://img.jb51.cc/vcimg/static/loading.png" alt="" src="http://img.blog.csdn.net/20130821231452296"> 650) this.width=650;" src="http://img.jb51.cc/vc

转载请注明出处:http://www.52php.cn/article/p-vslmamwp-dk.html



正确答案:D

根据题意WHERE条件的意思是“street_address”列中第一个位置不为字符(即为数字),执行以上SQL语句,如下结果:

hr@MYDB> SELECT street_address   2  FROM locations   3  WHERE   4  REGEXP_INSTR(street_address,'[^[:alpha:]]')=1;  STREET_ADDRESS ---------------------------------------- 1297 Via Cola di Rie 93091 Calle della Testa 2017 Shinjuku-ku 9450 Kamiya-cho 2014 Jabberwocky Rd 2011 Interiors Blvd 2007 Zagora St 2004 Charade Rd 147 Spadina Ave 6092 Boxwood St 40-5-12 Laogianggen 1298 Vileparle (E) 12-98 Victoria Street 198 Clementi North 8204 Arthur St 9702 Chester Road 20 Rue des Corps-Saints  17 rows selected.



REGEXP_INSTR函数

语法

说明

REGEXP_INSTR(source_string,pattern
[,start_position
[,occurrence
[,return_option
[,match_parameter]]]])

该函数查找pattern,并返回该模式的第一个位置。您可以随意指定您想要开始搜索的 start_position。 occurrence 参数默认为 1,除非您指定您要查找接下来出现的一个模式。return_option 的默认值为 0,它返回该模式的起始位置;值为 1 则返回符合匹配条件的下一个字符的起始位置。


'^'匹配输入字符串的开始位置,在方括号表达式中使用,此时它表示不接受该字符集合。

[[:alpha:]]任何字母

[^[:alpha:]]非任何字母

如下操作:

gyj@MYDB> select REGEXP_INSTR('guoyJoe','[^[:alpha:]]') from dual;  REGEXP_INSTR('GUOYJOE','[^[:ALPHA:]]') --------------------------------------                                      0 gyj@MYDB> select REGEXP_INSTR('1guoyJoe','[^[:alpha:]]') from dual;  REGEXP_INSTR('1GUOYJOE','[^[:ALPHA:]]') ---------------------------------------                                      


参考官方文档:

 

Examples

The following example examines the string,looking for occurrences of one or more non-blank characters. Oracle begins searching at the first character in the string and returns the starting position (default) of the sixth occurrence of one or more non-blank characters.

gyj@MYDB> SELECT   2    REGEXP_INSTR('500 Oracle Parkway,Redwood Shores,CA',3                 '[^ ]+',1,6) "REGEXP_INSTR"   4    FROM DUAL;   REGEXP_INSTR ------------           37

The following example examines the string,looking for occurrences of words beginning with s,r,or p,regardless of case,followed by any six alphabetic characters. Oracle begins searching at the third character in the string and returns the position in the string of the character following the second occurrence of a seven-letter word beginning with s,regardless of case.
gyj@MYDB> SELECT   2    REGEXP_INSTR('500 Oracle Parkway,3                 '[s|r|p][[:alpha:]]{6}',3,2,'i') "REGEXP_INSTR"   4    FROM DUAL;   REGEXP_INSTR ------------           28


QQ:252803295

学习交流QQ群:
DSI&Core Search Ⅰ 群:127149411(技术:已满)
DSI&Core Search Ⅱ 群:177089463(技术:未满)
DSI&Core Search Ⅲ 群:284596437(技术:未满)
DSI&Core Search Ⅳ 群:192136702(技术:未满)
DSI&Core Search Ⅴ 群:285030382(闲聊:未满)



MAIL:oracledba_cn@hotmail.com

BLOG:http://blog.csdn.net/guoyjoe

WEIBO:http://weibo.com/guoyJoe0218

ITPUB:http://www.itpub.net/space-uid-28460966.html

OCM: http://education.oracle.com/education/otn/YGuo.HTM

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读