How to solve the problem of \[ formatting disorder in regular expressions

一个新手
Release: 2017-09-20 10:00:01
Original
1738 people have browsed it

在写csdn博客中,如果一段js代码中存在以下的正则表达式,发布时排版会错乱。如下


当发布出去浏览时,是这样的...


原因就在于"\["。解决方式是通过new RegExp()的方式构建正则表达式对象。

var regex = new RegExp("\\[.{8}\\]", "g");
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!