任何主体都给出了如何使用正则表达式删除字符串中的mathjax的解决方案。例如,我的输入字符串是
“哪一句解释了为什么$!\overline{AB}!$的斜率等于$!\overline{BC}!$?的斜率”,我所期望的是“哪一句解释了为什么斜率等于$!\overline{BC}!$?的斜率?”
发布于 2016-12-14 05:06:21
你可以试试这个:
\$!.*?!\$样本码
final String regex = "\\$!.*?!\\$";
final String string = "Which sentence explains why the slope of $!\\overline{AB}!$ is equal to the slope of $!\\overline{BC}!$?";
final Pattern pattern = Pattern.compile(regex);
final Matcher matcher = pattern.matcher(string);
final String result = matcher.replaceAll("");
System.out.println(result);https://stackoverflow.com/questions/41135103
复制相似问题