用正则表达式对HTML文件进行解析String strPage=getPage(); //网页源码字符串
String Title;
String regexp3 = "<\\s*a\\s+href((?!title).)+title\\s*=\\s*\"([^\"]*)\">";
PatternCompiler paCompiler = new Perl5Compiler();
Pattern patt3 = paCompiler.compile(regexp3,Perl5Compiler.CASE_INSENSITIVE_MASK);
PatternMatcher matcher = new Perl5Matcher();
PatternMatcherInput matcherInput1 = new PatternMatcherInput(strPage);
if(matcher.contains(matcherInput1,patt3))
{
MatchResult result3 = matcher.getMatch();
Title += result3.group(2);
}
编译通过
执行报:Exception in thread "main" java.lang.StackOverflowError请问是什么原因,高手指教
String Title;
String regexp3 = "<\\s*a\\s+href((?!title).)+title\\s*=\\s*\"([^\"]*)\">";
PatternCompiler paCompiler = new Perl5Compiler();
Pattern patt3 = paCompiler.compile(regexp3,Perl5Compiler.CASE_INSENSITIVE_MASK);
PatternMatcher matcher = new Perl5Matcher();
PatternMatcherInput matcherInput1 = new PatternMatcherInput(strPage);
if(matcher.contains(matcherInput1,patt3))
{
MatchResult result3 = matcher.getMatch();
Title += result3.group(2);
}
编译通过
执行报:Exception in thread "main" java.lang.StackOverflowError请问是什么原因,高手指教
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货