正则表达式中,用()表示group,而括号内捕获的内容可以供后面使用
但是如果我不想捕获,只不过用()表示纯粹的群组,比如说(abd)+,这里我不想捕获,只是为了表示abdabd而已。怎么办呢?JDK里面有
Groups beginning with (? are pure, non-capturing groups that do not capture text and do not count towards the group total
但是没有例子,具体怎么写?
我实验了(?abc)+,(//?abc)+,(?abc?)+,等,都不行,哪位高手指教一下。
但是如果我不想捕获,只不过用()表示纯粹的群组,比如说(abd)+,这里我不想捕获,只是为了表示abdabd而已。怎么办呢?JDK里面有
Groups beginning with (? are pure, non-capturing groups that do not capture text and do not count towards the group total
但是没有例子,具体怎么写?
我实验了(?abc)+,(//?abc)+,(?abc?)+,等,都不行,哪位高手指教一下。
解决方案 »
- 按下键盘上的箭头怎么对应程序里的箭头?
- 多线程访问全局变量
- 求教j2se,j2ee项目里非常多的小文件有什么好的方法扫描病毒!!!
- Java菜鸟问题
- 问一下子类父类的问题。谢谢很简单。帮忙回答下。
- java并口通讯问题
- JFrame改变大小后触发了什么事件?应该执行什么接口?
- 我安装了jbuilder9 在编辑区内的中文输入一律显示成小方块 无法正常显示中文 英文正常 我应该如何解决?
- 谁能帮我把下面的程序加上注释说明一下程序运行的过程吗?谢谢.
- 麻烦hht(影舞者)老兄看过来!!
- JAVA的日期转换?
- 为什么在Tomcat 5.0.28下我用自己写的JNI程序不能读取HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\ODBC Data Sources下面的值名?
Pattern patt = Pattern.compile("(abc)+");Matcher match = patt.matcher(content );if (patch.find())
....
(?idmsux-idmsux) Nothing, but turns match flags on - off
(?idmsux-idmsux:X) X, as a non-capturing group with the given flags on - off
(?=X) X, via zero-width positive lookahead
(?!X) X, via zero-width negative lookahead
(?<=X) X, via zero-width positive lookbehind
(?<!X) X, via zero-width negative lookbehind
(?>X) X, as an independent, non-capturing group
最后再问一下,象这种JDK上面没有的,在哪里查找呢?