关于正则表达式!求教
求教高手解答!!!感激不尽
Pattern p1 = Pattern.compile("^[A-Z]{4,}+$");
for(int i = 0;i<hostErrorMessage.length()-3;i++){
int j = i+4;
String input = hostErrorMessage.substring(i, j);
if(p1.matcher(input).matches()){
LianaErrorInfo errorInfo = LianaStandard.getErrorInfo(hostReturnCode);
hostErrorMessage = ( errorInfo != null ) ? errorInfo.getShowMsg() : "";
if(hostErrorMessage == null || hostErrorMessage.length() == 0){
hostErrorMessage = "结果失败";
}
break;
}
}
现在的问题是hostErrorMessage可能返回是一串文字,比如"封套内不得夹带现金及贵重物品",要把去掉“封套内不得夹带现金及”最后只显示“贵重物品”,以上代码该怎么改?