没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
package com.regular.test;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RegularTest {
public static void main(String[] args) throws Exception {
test();
}
public static void test() throws Exception{
Pattern p, ln;
Matcher m;
String reg = "(?s)(.*?<%@[^>]*?page[^>]*?pageEncoding[^>=]*=[^>\"]*)(\"([^\"]*)\"[^>]*?%>)";
p = Pattern.compile(reg);
ln = Pattern.compile("\r\n?");
m = p.matcher(getContent());
int i = 1;
while (m.find()) {
i += getLnCount(m.group(1), ln);
System.out.println( "line : " + i + ", content: " + m.group(3).trim());
i += getLnCount(m.group(2), ln);
}
}
public static int getLnCount(String str, Pattern ln) {
if(str==null) {
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RegularTest {
public static void main(String[] args) throws Exception {
test();
}
public static void test() throws Exception{
Pattern p, ln;
Matcher m;
String reg = "(?s)(.*?<%@[^>]*?page[^>]*?pageEncoding[^>=]*=[^>\"]*)(\"([^\"]*)\"[^>]*?%>)";
p = Pattern.compile(reg);
ln = Pattern.compile("\r\n?");
m = p.matcher(getContent());
int i = 1;
while (m.find()) {
i += getLnCount(m.group(1), ln);
System.out.println( "line : " + i + ", content: " + m.group(3).trim());
i += getLnCount(m.group(2), ln);
}
}
public static int getLnCount(String str, Pattern ln) {
if(str==null) {
资源评论
- 随风流22014-11-27资料还不错!1分是肯定值了!
Jared_self
- 粉丝: 2
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功