123
返回列表 发新帖
楼主: sinkeler

[SCJP] 问一个关于正则表达式的问题,关于SCJP考试

[复制链接]
论坛徽章:
387
马上加薪
日期:2014-07-30 15:56:19itpub13周年纪念徽章
日期:2014-09-30 11:08:572015年新春福章
日期:2015-03-04 14:19:112015年新春福章
日期:2015-03-06 11:57:31
21#
发表于 2008-1-25 16:35 | 只看该作者
菜虫,整理一下你的学习笔记!
整理到一个汇总帖子里。
做好了等着加精

使用道具 举报

回复
论坛徽章:
3
生肖徽章2007版:牛
日期:2008-09-25 19:22:372009新春纪念徽章
日期:2009-01-04 14:52:28生肖徽章2007版:狗
日期:2009-01-14 14:14:37
22#
 楼主| 发表于 2008-1-25 16:40 | 只看该作者
……

多谢了,回头我整理一下

使用道具 举报

回复
论坛徽章:
8
开发板块每日发贴之星
日期:2007-12-23 01:06:08开发板块每日发贴之星
日期:2007-12-24 01:05:56开发板块每日发贴之星
日期:2007-12-27 01:05:492008新春纪念徽章
日期:2008-02-13 12:43:03开发板块每日发贴之星
日期:2008-02-14 01:02:08开发板块每日发贴之星
日期:2008-02-15 01:05:13开发板块每日发贴之星
日期:2008-02-16 01:06:48开发板块每日发贴之星
日期:2008-02-17 01:05:20
23#
发表于 2008-1-25 20:25 | 只看该作者
m.group(): (start(), end())

Roger!

[ 本帖最后由 silver_xie 于 2008-1-25 20:31 编辑 ]

使用道具 举报

回复
论坛徽章:
8
开发板块每日发贴之星
日期:2007-12-23 01:06:08开发板块每日发贴之星
日期:2007-12-24 01:05:56开发板块每日发贴之星
日期:2007-12-27 01:05:492008新春纪念徽章
日期:2008-02-13 12:43:03开发板块每日发贴之星
日期:2008-02-14 01:02:08开发板块每日发贴之星
日期:2008-02-15 01:05:13开发板块每日发贴之星
日期:2008-02-16 01:06:48开发板块每日发贴之星
日期:2008-02-17 01:05:20
24#
发表于 2008-1-25 20:40 | 只看该作者
Pattern is (\w)*
//////////////////////
i=0
start=0 end=6
>ab34ef<
groupCount()=1
//////////////////////
i=1
start=6 end=6
><
groupCount()=1

E:\scjp_exam\MyTest\src\studyGuide>javac -d ..\..\class Regex.java

E:\scjp_exam\MyTest\src\studyGuide>java Regex
Pattern is \w*
//////////////////////
i=0
start=0 end=6
>ab34ef<
groupCount()=0
//////////////////////
i=1
start=6 end=6
><
groupCount()=0

[ 本帖最后由 silver_xie 于 2008-1-25 20:42 编辑 ]

使用道具 举报

回复
论坛徽章:
3
生肖徽章2007版:牛
日期:2008-09-25 19:22:372009新春纪念徽章
日期:2009-01-04 14:52:28生肖徽章2007版:狗
日期:2009-01-14 14:14:37
25#
 楼主| 发表于 2008-1-28 13:29 | 只看该作者
After a busy weekend, I am back at this forum.

Well, it seems that the additional quantifier * following the pattern, by which there are different output with groupCount(), we cared is not the essence of the question, even excesses the range of the test issued by sun, especially the SCJP.

Actually, the intention of the question is about to verify the elementary concept of the regular expression, greedy quantifier *, which is a markable concept in the regular expression practically. All the options you need to choose in this question assumed that 6 is the default answer that everyone should know. I just want to make it clear to fill in my knowledge storage. hehe

Thanks for your help, silver. Maybe another theme should be added for us to clear the problems at this question such as the groupCount(). haha

使用道具 举报

回复

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

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表