正则表达式使用案例-OCP试题

前端之家收集整理的这篇文章主要介绍了正则表达式使用案例-OCP试题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
92. Evaluate the following expression using Meta. character for regular expression:
'[^Ale|ax.r$]'
Which two matches would be returned by this expression? (Choose two.)
A. Alex
B. Alax
C. Alxer
D. Alaxendar
E. Alexender
Answer: DE

解析:题目的意思是哪两个选项能和'[^Ale|ax.r$]'匹配
'[^Ale|ax.r$]'中^表示只匹配不在集合{'A','l','e','|','a','x','.','r','$'}中的字符,此处的'|'、'.'、'$'只是表示普通的字符,而非匹配符 select regexp_instr('Alex','[^Ale|ax.r$]') from dual; REGEXP_INSTR('ALEX','[^ALE|AX.R$]') ----------------------------------- 0 select regexp_instr('Alax','[^Ale|ax.r$]') from dual; REGEXP_INSTR('ALAX','[^ALE|AX.R$]') ----------------------------------- 0 select regexp_instr('Alxer','[^Ale|ax.r$]') from dual; REGEXP_INSTR('ALXER','[^ALE|AX.R$]') ------------------------------------ 0 select regexp_instr('Alaxendar','[^Ale|ax.r$]') from dual; REGEXP_INSTR('ALAXENDAR','[^ALE|AX.R$]') ---------------------------------------- 6 select regexp_instr('Alexender','[^Ale|ax.r$]') from dual; REGEXP_INSTR('ALEXENDER','[^ALE|AX.R$]') ---------------------------------------- 6 因此可见答案是DE 转自:http://www.itpub.net/forum.PHP?mod=viewthread&tid=1327778
原文链接:https://www.f2er.com/regex/361027.html

猜你在找的正则表达式相关文章