0

我正在尝试用“”(Null)替换以下内容

java.util.regex.PatternSyntaxException: Syntax error U_REGEX_BAD_INTERVAL near index 50:

01-05 14:11:14.660: E/AndroidRuntime(1546): FATAL EXCEPTION: main
01-05 14:11:14.660: E/AndroidRuntime(1546): java.util.regex.PatternSyntaxException: Syntax error U_REGEX_BAD_INTERVAL near index 50:
01-05 14:11:14.660: E/AndroidRuntime(1546): <html><head>  <style type="text/css">@font-face { font-family: MyCustomFont;  src: url("file:///android_asset/fonts/MyriadPro-Regular.otf") }body { font-family: MyCustomFont; font-size:14.0pt; text-align: center;vertical-align:middle;line-height: normal;} </style> </head><body>

我收到此错误这里有什么问题?

编辑

这是我的代码

"a"包含带有标签的值

<html><head>  <style type="text/css">@font-face { font-family: MyCustomFont;  src: 
url("file:///android_asset/fonts/MyriadPro-Regular.otf") }body { font-family:MyCustomFont;
 font-size:14.0pt; text-align: center;vertical-align:middle;line-height: normal;}    </style>
</head><body>365<i>xy</i></body></html>


val =<html><head>  <style type=\"text/css\">"
        + "@font-face { font-family: MyCustomFont;  src: url(\"file:///android_asset/fonts/MyriadPro-Regular.otf\") }"
        + "body { font-family: MyCustomFont; font-size:"14.0pt"; text-align: center;vertical-align:middle;line-height: normal;}</style></head><body>
a.getText().replaceAll(val, "") 
4

1 回答 1

0

尝试

a.getText().replaceAll(java.util.regex.Pattern.quote(val), "") 

这将在您的模式中引用特殊字符。

顺便提一句。这是删除标题的一种非常脆弱的方法。如果标题稍作更改,它将不再被删除。

于 2013-01-10T07:03:23.597 回答