我想在文本中搜索小于号 <
在美元符号之间,如 $x<y$
并将其替换为 $x < y$
.
我正在使用 mathjax,小于号会导致渲染 Mathjax 时出现一些问题。(参见此处:http://docs.mathjax.org/en/latest/tex.html#tex-and-latex-in-html-documents)。
我试过了
$text = preg_replace("/\$(.*?)(<)(.*?)\$/","/\$$1 < $3\$/",$text)
但我不确定这是否是一个好的解决方案。我是编程新手:)
感谢您的帮助。
最佳答案
关于php - 将 $x<y$ 替换为 $x < y$,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38639028/