首页上一页 1  下一页尾页 1 条记录 1/1页
        用JAVA过滤保存为TXT文档的HTML文件的问题
                 	
                        发表在Java图书答疑
                        2013-11-17                                                
                    		
                                                                            	
                        
                        
                    
                    
                    	是否精华
                    	是
                    	否
                    
                    
                    
                            版块置顶:
                            是
                            否
                        
                    
                                           package com.test;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class FileTest {
public static void main(String[] args) throws Exception{
File file = new File("E:/heihei1/xiazai.txt");
StringBuilder sb = new StringBuilder();
String s ="";
BufferedReader br = new BufferedReader(new FileReader(file));
while( (s = br.readLine()) != null) {
sb.append(s + "\n");
}
br.close();
String str = sb.toString();
String regEx = "[\\u4e00-\\u9fa5]";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(str);
System.out.print("提取出来的中文有:");
while (m.find()) {
System.out.print(m.group(0)+" ");
}
}
}
其中的xiazai.txt文档为抓取的HTML文档, 为什么过滤出的内容不显示,好像是txt文档内容太多了,当自己输入一些文字是还可以滤出来,请问是什么原因,该怎么修改
                
        	
        
        
    import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class FileTest {
public static void main(String[] args) throws Exception{
File file = new File("E:/heihei1/xiazai.txt");
StringBuilder sb = new StringBuilder();
String s ="";
BufferedReader br = new BufferedReader(new FileReader(file));
while( (s = br.readLine()) != null) {
sb.append(s + "\n");
}
br.close();
String str = sb.toString();
String regEx = "[\\u4e00-\\u9fa5]";
Pattern p = Pattern.compile(regEx);
Matcher m = p.matcher(str);
System.out.print("提取出来的中文有:");
while (m.find()) {
System.out.print(m.group(0)+" ");
}
}
}
其中的xiazai.txt文档为抓取的HTML文档, 为什么过滤出的内容不显示,好像是txt文档内容太多了,当自己输入一些文字是还可以滤出来,请问是什么原因,该怎么修改

 
	
                                                 VIP会员
VIP会员 购物车
购物车

 私信
                         私信 
                     发表新帖
发表新帖 立即签到
立即签到 
        		  
        		 
         		 关注
关注
                  回复
 回复 支持(
                	支持( 反对(
                    反对( 
                    
 
                







 
                     
                     
					 
						 
						 
						 
						