首页 > 技术文章 > 测试

inevermore 2014-09-26 23:46 原文

 

 

使用Windows live Writer编写博客

 

测试代码

 

/**
     * 从一段文本中检索出唯一的结果
     * @param regx 正则表达式语句
     * @param text 要检索的文本
     * @return
     */
    public String regx(String regx,String text)
    {
        Matcher matcher=Pattern.compile(regx).matcher(text);
        if(matcher.find())
            return matcher.group();
        else
            return null;
    }

推荐阅读