Home > Article > Web Front-end > How to solve the problem of \[ formatting disorder in regular expressions
在写csdn博客中,如果一段js代码中存在以下的正则表达式,发布时排版会错乱。如下
当发布出去浏览时,是这样的...
原因就在于"\["。解决方式是通过new RegExp()的方式构建正则表达式对象。
var regex = new RegExp("\\[.{8}\\]", "g");
The above is the detailed content of How to solve the problem of \[ formatting disorder in regular expressions. For more information, please follow other related articles on the PHP Chinese website!