打印本文 打印本文 关闭窗口 关闭窗口
Regular Expression 正则表达式-2 (Java)
作者:武汉SEO闵涛  文章来源:敏韬网  点击数1985  更新时间:2009/4/25 0:45:06  文章录入:mintao  责任编辑:mintao
;        while( (line=rd.readLine()) != null )
            {
                
sb.append(line);
            }
            
strRet = sb.toString();            
        }
catch( Exception e )
        {
            
e.printStackTrace();
        }
finally{
            
try{
                if(
rd != null )
                    
rd.close();
            }
catch( Exception e ){
                
e.printStackTrace();
            }
        }
        return
strRet;
    }
    
private static String filter(String input)
    {
        
Pattern p = Pattern.compile("\"(\\w+):(\\w+)%(\\w+)\"");
        
Matcher m = p.matcher(input);
        
StringBuffer sb = new StringBuffer();
        while(
m.find())
        {
            
sb.append( m.group(1) + ":" + m.group(2) + "*" + m.group(3) + "," + System.getProperty("line.separator") );
        }
        return
sb.toString();
    }
}

上一页  [1] [2] 

打印本文 打印本文 关闭窗口 关闭窗口