【发布时间】:2009-05-15 18:15:54
【问题描述】:
errorString="AxisFault\n
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException\n
faultSubcode: \n
faultString: My Error\n
faultActor: \n
faultNode: \n
faultDetail: \n
{}string: this is the fault detail"
Pattern pattern = Pattern.compile(".*faultString(.*)", Pattern.DOTALL);
Matcher matcher = pattern.matcher(errorString);
if (matcher.matches()) {
String match = matcher.group(1);
return match;
}
我想得到“我的错误”,但它返回到整个字符串的末尾,而不是匹配到 faultString 行末尾的 \n。我尝试了很多技术让它在行尾停止,但没有成功。
谢谢
【问题讨论】: