Examinee

xuanlw 2010-09-02

packagecom.huaweisymantec.rmc.mail;

importjava.util.regex.Matcher;

importjava.util.regex.Pattern;

//输入一行要解析的字符串,和相应的正则表达式和序号返回解析后的字符串

publicclassExaminee{

staticStringsubString=null;

publicStringexamine(Strings,Stringregex,inti)

{

Displayd=newDisplay(regex);

Patternp=Pattern.compile(regex);

Matcherm=p.matcher(s);

while(m.find())

{

StringmGroup=m.group();

subString=mGroup.substring(2,mGroup.length()-1);

System.out.println(i+subString);

}

returnsubString;

}

publicstaticStringgetSubString()

{

returnsubString;

}

}

相关推荐