|
@@ -39,9 +39,28 @@ public class Answer {
|
|
}
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
- String s="<p><span style=\"color: #4e4e4e; font-family: -apple-system, system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 15px; white-space: nowrap; background-color: #e4e4e4;\">为知笔记</span></p>";
|
|
|
|
- System.out.println(disBody(s));
|
|
|
|
|
|
+ String s="重力为P的圆球##1##放在板AC与##2##墙壁AB之间,如图所示。设板AC的重力不计,试作出球的受力图。<br/><img src=\"https://file.mshiedu.com/wisdomquestion/2023-5-16/mXQHiuaKLsYT6azLRSfj6praZ4EdPX2DsMHERvmkpA4YIoRY2a.jpeg\"/>发的发的发的<>";
|
|
|
|
+ System.out.println(relaceQuestionIdx(s));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public static String relaceQuestionIdx(String str) {
|
|
|
|
+ StringBuffer sb = new StringBuffer("");
|
|
|
|
+ Pattern pattern = Pattern.compile("##(\\d+)##");
|
|
|
|
+
|
|
|
|
+ Matcher matcher = pattern.matcher(str);
|
|
|
|
+
|
|
|
|
+ while (matcher.find()) {
|
|
|
|
+ String idx = matcher.group(1);
|
|
|
|
+ matcher.appendReplacement(sb, "___" + idx + "___");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isEmpty(sb.toString())) {
|
|
|
|
+ return str;
|
|
|
|
+ } else {
|
|
|
|
+ matcher.appendTail(sb);
|
|
|
|
+ return sb.toString();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
private static String disBody(String html) {
|
|
private static String disBody(String html) {
|
|
Document doc = Jsoup.parse(html);
|
|
Document doc = Jsoup.parse(html);
|