JAVA中用正则表达式做全文查找
来源:互联网 发布:文件防拷贝软件 编辑:程序博客网 时间:2024/04/30 19:15
import java.util.regex.*;
class Regex1{
public static void main(String args[]) {
String content="For my money, the important thing "+"about the meeting was bridge-building";
String regEx="a|f"; //表示a或f
Pattern p=Pattern.compile(regEx);
Matcher propsMatcher=p.matcher(content);
while(m.find()){
int startIndex = propsMatcher.start(); // index of start
int endIndex = propsMatcher.end(); // index of end + 1
// retrieve the matching substring
String currentMatch = content.substring(startIndex, endIndex);
System.out.println(currentMatch);
}
}
}
- JAVA中用正则表达式做全文查找
- java中用正则表达式解析LRC文件
- java中用正则表达式解析LRC文件
- Java中用正则表达式找出数字
- java中用正则表达式解析LRC文件
- Java中用正则表达式截取字符串
- java中用正则表达式进行判断
- java正则表达式 前后查找
- Visual Studio 2005 中用正则表达式查找特殊字符串
- Visual Studio 2005 中用正则表达式查找特殊字符串
- 在vs2005中用正则表达式查找或替换
- 在vs2005中用正则表达式查找或替换
- 正则表达式,全文匹配
- Oracle中用正则表达式
- JAVA正则表达式匹配,替换,查找,切割
- java 正则表达式查找包含的字符串
- JAVA正则表达式匹配,替换,查找,切割
- JAVA正则表达式匹配,替换,查找,切割
- [数据库连接字符串] Access 连接字符串
- VC 文件操作
- 技术之路 - www.techroad.org
- 现在所能做的
- MySQL创建存储过程实例
- JAVA中用正则表达式做全文查找
- [数据库连接字符串] Access2007 连接字符串
- 自定义分页不在苦恼!!
- 最简单的Spring入门示例
- 特殊服务的"注册表入口"
- Delphi控件开发浅入深出(三)
- Delphi控件开发浅入深出(四)
- #pragma
- 说明"登录的帐户"