- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个大字符串,其中包含多个 mathml。想把一个字符串数组中的全部取出来。使用正则表达式来查找它们。但正则表达式中缺少某些内容,因此它不会提供任何输出。
MathMls 的正则表达式是什么?
示例字符串
Find sum of «math xmlns=\"http://www.w3.org/1998/Math/MathML\"»«mroot»«mrow»«mi»#«/mi»«mi»a«/mi»«/mrow»«mn»3«/mn»«/mroot»«mo»=«/mo»«mroot»«mrow»«mi»#«/mi»«mi»b«/mi»«/mrow»«mn»3«/mn»«/mroot»«/math» and «math xmlns=\"http://www.w3.org/1998/Math/MathML\"»«mo»=«/mo»«msup»«mfenced»«mrow»«mi»#«/mi»«mi»b«/mi»«/mrow»«/mfenced»«mfrac»«mn»1«/mn»«mn»3«/mn»«/mfrac»«/msup»«/math»
从中得到 2 个 mathml
最佳答案
您无法使用 Java 的正则表达式引擎执行此操作,因为这是有效的输入:
<math>
<apply>
<plus/>
<apply>
<times/>
<ci>a</ci>
<apply>
<power/>
<ci>x</ci>
<cn>2</cn>
</apply>
</apply>
<apply>
<times/>
<ci>b</ci>
<ci>x</ci>
</apply>
<ci>c</ci>
</apply>
</math>
即:可以有任意嵌套标签,并且 Java 的正则表达式引擎无法匹配递归模式。您将不得不诉诸some parser处理 MathML 输入。
Can i consider the entire thing as a string and find for a pattern which matches ? That is what i am trying. And there is not going to be any recursive tags inside another tag. they will be in same level.
在这种情况下,请尝试以下模式:
<math[>\s](?s).*?</math>
或作为字符串文字:
"<math[>\\s](?s).*?</math>"
这意味着:
<math[>\s] # match `<math` followed by a space or `>`
(?s).*? # reluctantly match zero or more chars (`(?s)` causes `\r`
# and `\n` also to be matched)
</math> # match `</math>`
关于java - 使用 java 从字符串中查找 mathml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6137438/
我有一个 MATHML 公式(由 http://www.mathtoweb.com/cgi-bin/mathtoweb_online.pl 生成)。我想将其粘贴到 Libreoffice 中。我怎样才
我不明白什么? 下面的代码工作正常: from sympy.printing.mathml import print_mathml s = "x**2 + 8*x + 16" print_mathml
我有一些网页大量使用 MathJax(或 MathML?),我想将其转换成电子书并显示在我的 kindle 上,它不支持足够的 javascript,也不支持 MathML。所以我想预处理 .html
我的浏览器 Firefox 3.6 似乎可以很好地显示 W3C 测试套件中的 Mathml 方程。但是,如果我将代码复制到我的网页中,例如 here ,所有 Firefox 生成的都是类似于 x y
我今天发现 Windows 7 带有一个非常令人印象深刻的 MathPanel 实用程序,用于执行方程的手写识别: 这很好。 (这里我已经输入了 sRGB 颜色空间 Gamma 转换部分的公式) 但现
我们很快就会开始开发 TeX 到 MathML 的转换器。所以,我想知道哪些浏览器(从哪个版本开始)正式支持 MathML?谢谢 最佳答案 几乎没有,只有 Firefox 和 Safari 可以处理
我试图显示一个简单的方程式,但它不起作用。我的代码如下(html5): a i =
我有一个包含文本区域的页面。用户将在其中输入 mathML,当用户单击输出按钮时,MathML 应呈现并显示在文本区域下方。但是渲染没有发生。 Textarea 可能包含多个用于渲染的 mathml
我正在尝试构建与 this site 相同的功能用户将在文本区域中输入数学表达式并将其呈现为 MathML 格式。 例子: Input expression string: cos(x^3) Then
快速了解 MathML 及其在世界范围内的使用的最佳方法是什么? 我的意思是: 你用什么来渲染/编辑它 它是否用于您可以向我指出的任何商业/开源应用程序 它是否流行并被大量使用? 是否有可以在 C#、
我在使用我们的学习管理系统 (LMS) 中内置的 MathML 编辑器时发现了一些奇怪的东西。当我输入 float 时,它用 包裹小数点标签。 例如,我期望 1.2输出为: 1.2 但是,编辑器输出
我一直在努力为 ckeditor 添加 mathml 支持。我浏览了几个链接,但似乎没有一个起作用。我什至尝试过 ckeditor 的 WIRIS 插件,但它没有给我任何结果。对于WIRIS,我关注了
我在使用我们的学习管理系统 (LMS) 中内置的 MathML 编辑器时发现了一些奇怪的东西。当我输入 float 时,它用 包裹小数点标签。 例如,我期望 1.2输出为: 1.2 但是,编辑器输出
我使用 MathML 创建一些数据 block ,我需要通过 OpenXML SDK 将其插入到 docx 文件中。我听说这是可能的,但我没有做到。有人可以帮我解决这个问题吗? 最佳答案 据我所知,O
我正在使用 MathDox用于生成 MathML 的公式编辑器。现在我想将 MathDox 生成的 MathML 转换为表达式,稍后我可以使用它来评估以找到答案。 For eg: MathML:
我想像这样转换表达式: “a*x^2+b*x^2+c+d”…… “对数((a*x)/sin(x))”... “1/x”... 使用 JavaScript 进入 MathML。有什么建议么?我找到的最接
我有一个 PHP 脚本输出:((5^2x^2)^2+3)/(sqrt(sqrt(81))) 我希望它像您编写的那样正确格式化。 在哪里可以找到这样的 ASCII 到 MathML 转换器:http:/
我正在尝试为用户实现一种输入简化数学符号的方法,而不是传统的 LaTex 符号。然后将使用 MathJax 呈现表达式的结果。但我似乎找不到“简化的数学符号”或 ad-hoc ASCII 到 late
具体来说(MathJax 不是我要找的)我有一个网页,里面有一些 MathML。“FireFox”浏览器可以很好地解析它,但是当我尝试通过 javascript 添加相同的代码时,它没有'解析它。如何
MathML是一种编写数学的网络标准,可以轻松缩放而无需像素化(就像 SVG)、复制和粘贴以及屏幕阅读器阅读。 Chrome 拒绝在存在 JavaScript polyfill 的基础上实现它。 (I
我是一名优秀的程序员,十分优秀!