当前位置: 首页 > news >正文

优秀的网页网站设计百度搜索官网

优秀的网页网站设计,百度搜索官网,天津高端网页制作,商贸公司企业简介模板参考#xff1a;http://blog.chenlb.com/2008/12/java-regular-expression-special-constructs-ornon-capturing-group.html 在 java api 文档中的正则表达式关于特殊构造(非捕获组)的说明看不懂。例如#xff1a; (?:X)X#xff0c;作为非捕获组(?idmsux-idmsux)Nothing…参考http://blog.chenlb.com/2008/12/java-regular-expression-special-constructs-ornon-capturing-group.html 在 java api 文档中的正则表达式关于特殊构造(非捕获组)的说明看不懂。例如 (?:X)X作为非捕获组(?idmsux-idmsux)Nothing但是将匹配标志由 on 转为 off(?idmsux-idmsux:X)X作为带有给定标志 on - off 的非捕获组(?X)X通过零宽度的正 lookahead(?!X)X通过零宽度的负 lookahead(?X)X通过零宽度的正 lookbehind(?!X)X通过零宽度的负 lookbehind(?X)X作为独立的非捕获组 这些字都说的很抽象。不懂……。还是搜索下去。找到 火龙果 的解释如下 以 (? 开头) 结尾的都称为非捕获组在匹配完成后在内存中不保留匹配到的字符。 非捕获组的应用比较复杂这里只能简单地说一下它们的意思。 1、(?:X) X作为非捕获组 与捕获组 ( ) 的意思一样也是将其作为一组进行处理与捕获组的区别在于不捕获匹配的文本仅仅作为分组。 比如 要匹配 123123 这个就可以写为 (123)\1 使用反向引用这时只能用捕获组在匹配123 后会保留在内存中便于反向引用 (?:123) 在匹配完后则不会保留反向引用区别仅在于此。不保留反向引用可以节省内存提高效率。 (123)\1等效(?:123)123代码示例 /*** outputs* 模式(123)\1* 123123*/Pattern p Pattern.compile((123)\\1);Matcher m p.matcher(ad123dfe123123grr);System.out.println(模式(123)\\1);while(m.find()){System.out.println(m.group());}/*** outputs* 模式(?:123)123* 123123*/p Pattern.compile((?:123)123);m p.matcher(ad123dfe123123grr);System.out.println(模式(?:123)123);while(m.find()){System.out.println(m.group());}2、(?idmsux-idmsux)  Nothing但是将匹配标志i d m s u x on - off 用于标志匹配比如表达式 (?i)abc(?-i)def 这时(?i) 打开不区分大小写开关abc 匹配 不区分大小地进行匹配(?-i) 关闭标志恢复不区分大小写这时的 def 只能匹配 def //(?i)忽略大小写这个简单。但是只适合ASCII字符//当有俄文字符——小写б(大写Б)л(Л)这时要一起用(?u)p Pattern.compile((?i)(?u)sayбл);m p.matcher(This is a test sayбл hello.\nWello SayБЛ \nello?);System.out.println(参数为(?i)(?u));while(m.find()){System.out.println(m.group());}//单行模式下.可以匹配任何字符(包括\n)/*** outputs* hello* Wello* \nello*/p Pattern.compile((?s).ello);m p.matcher(This is a test say hello.\n Wello say \nello?);System.out.println(参数为(?s));while(m.find()){System.out.println(m.group());}//多行模式下\n 或\r\n 作为行的分隔符不匹配(.)/*** outputs:* hello* Wello*/p Pattern.compile((?m).ello);m p.matcher(This is a test say hello.\n Wello say \nello?);System.out.println(参数为(?m));while(m.find()){System.out.println(m.group());}//(?d)模式启动UNIX行模式只认 \n//UNIX 行: \n//WINDOWS 行\r\n/*** outputs:* ello start:27end:32* ello?start:37end:42*/p Pattern.compile((?m)ello.);m p.matcher(This is a test say hello\r\nWello say \nello?);System.out.println(参数为(?d));while(m.find()){System.out.println( m.group() start: m.start() end: m.end() );}//单独使用(?m)能依据\n 和\r\n 来分行/*** outputs:* ello* start:20end:25* ello start:27end:32* ello?start:37end:42*/p Pattern.compile((?d)(?m)ello.);m p.matcher(This is a test say hello\r\nWello say \nello?);System.out.println(参数为(?d));while(m.find()){System.out.println( m.group() start: m.start() end: m.end() );}//组合使用(?d)(?m)只能依据\n 来分行3、(?idmsux-idmsux:X)  X作为带有给定标志 i d m s u x on - off 与上面的类似上面的表达式可以改写成为(?i:abc)def或者 (?i)abc(?-i:def) 4、(?X) X通过零宽度的正 lookahead 5、(?!X) X通过零宽度的负 lookahead (?X) 表示当前位置即字符的缝隙后面允许出现的字符比如表示式 a(?b)在字符串为 ab 时可能匹配 a后面的 (?b) 表示a 后面的缝隙可以看作是零宽度。 (?!X) 表示当前位置后面不允许出现的字符 字符扫描从左到右所以前瞻即向右看后瞻即向左看 //a(?b)匹配a前瞻(lookahead)是b即ab但不捕获b/*** outputs* a:start4,end5* a:start9,end10*/p Pattern.compile(a(?b));m p.matcher(aacdabaaeabdaBh);System.out.println(a(?b));while(m.find()){System.out.println(m.group() :start m.start() ,end m.end());}//a(?!b)匹配a前瞻(lookahead)是非b即a[^b]但不捕获[^b]/*** outputs* a:start0,end1* a:start1,end2* a:start6,end7* a:start7,end8* a:start12,end13*/p Pattern.compile(a(?!b));m p.matcher(aacdabaaeabdaBh);System.out.println(a(?!b));while(m.find()){System.out.println(m.group() :start m.start() ,end m.end());}6、(? X) X通过零宽度的正 lookbehind 7、(? !X) X通过零宽度的负 lookbehind 这两个与上面两个类似上面两个是向后看这个是向前看 //(?b)a匹配a后瞻(lookbehind)是b即ba但不捕获b/*** outputs* a:start6,end7*/p Pattern.compile((?b)a);m p.matcher(aacdabaaeabdaBh);System.out.println((?b)a);while(m.find()){System.out.println(m.group() :start m.start() ,end m.end());}//(?!b)a匹配a后瞻(lookbehind)是非b即[^b]a但不捕获[^b]/*** outputs* a:start0,end1* a:start1,end2* a:start4,end5* a:start7,end8* a:start9,end10* a:start12,end13*/p Pattern.compile((?!b)a);m p.matcher(aacdabaaeabdaBh);System.out.println((?!b)a);while(m.find()){System.out.println(m.group() :start m.start() ,end m.end());}8、(?X) X作为独立的非捕获组 匹配成功不进行回溯这个比较复杂也侵占量词“”可以通用比如\d 可以写为 (?\d)。 //(?x)不回溯的匹配性能优化/*** outputs* integer:start5,end12* insert:start17,end23* in:start27,end29*/p Pattern.compile(\\b(?integer|insert|in)\\b);m p.matcher(test integer and insert of in it);System.out.println(\\b(?integer|insert|in)\\b);while(m.find()){System.out.println(m.group() :start m.start() ,end m.end());} // 换了个顺序结果大不一样/*** outputs* in:start27,end29*/p Pattern.compile(\\b(?in|integer|insert)\\b);m p.matcher(test integer and insert of in it);System.out.println(\\b(?in|integer|insert)\\b);while(m.find()){System.out.println(m.group() :start m.start() ,end m.end());}还没搞懂为什么换个顺序后结果就不同了反正别人建议是长的放前面短的放后面。至于原因嘛以后懂了再说。
http://www.zqtcl.cn/news/83453/

相关文章:

  • 做展会怎么引流到自己的网站进行网站开发
  • 建设中网站源码网站建设的一般过程包括哪些方面
  • 河北省住房城乡建设局网站网站域名的所有权
  • 企业国际网站建设什么网站做玩具的比较多
  • 摄影网站开发背景怎么写vps搭建网站
  • 网站开发先学前端还是后端织梦模板 行业网站
  • 网站站内链接怎么做网站开发过程前端后端
  • wordpress网站缩工程建设监理概论形考任务答案
  • 马鞍山网站设计怎么自己开一个平台
  • 云南网站建设运营网站排名提高
  • 邮箱购买网站网站地图制作视频教程
  • 六安网站建设全包深圳全网营销网站
  • 盗版系统网站怎么建立网站自动适应屏幕
  • 房地网站制作网站的策划方案怎么写
  • 建设银行陕西省分行网站专业网站开发平台
  • 网站建设策划方案书论文软件开发项目报价模板
  • 大连自助建站软件wordpress 文章评价插件
  • 网站建设承揽合同网站建设酷隆
  • 企业对企业的网站国内电子商务网站有哪些
  • p2p网贷网站建设公司河北建设工程招标协会网站
  • 淘宝电商网站怎么做百度app下载安装普通下载
  • 做便宜网站公司简介模板简洁大方
  • 乐器销售网站模板计算机网页制作题教程
  • 海淀区手机网站制作服务庆阳网站网站建设
  • 沈阳网站推广¥做下拉去118cr外贸英文网站制作
  • 网站规划建设与管理维护论文公司网站功能性建设有哪些
  • 聊城哪里做网站做庭院景观的那个网站推广好
  • 个人网站起个名字天津住房和城乡建设厅网站
  • 福州 福马路 网站建设青岛网站建设青岛博采网络
  • 网站建设的公司在哪找支持wordpress主机