Jquery html中的正则表达式不匹配

Jquery html中的正则表达式不匹配,jquery,html,css,Jquery,Html,Css,我在js文件的变量卡中有一块html代码。我在变量卡错误中发现正则表达式不匹配。所有单引号和双引号都匹配。我在html块中出错的是任何打字错误 (function ($) { Drupal.behaviors.one_time_popup = { attach: function (context, settings) { var celeType=Drupal.settings.one_time_popup.celeType; card="<div class=\'cardTempla

我在js文件的变量卡中有一块html代码。我在变量卡错误中发现正则表达式不匹配。所有单引号和双引号都匹配。我在html块中出错的是任何打字错误

(function ($) {
Drupal.behaviors.one_time_popup = {
attach: function (context, settings) {
var celeType=Drupal.settings.one_time_popup.celeType;
 card="<div class=\'cardTemplate-aniv\'> 
 <p class=\'bir-anniv-wishes\'>Happy Birthday and Successful Anniversary</p>
 <p id=\'aspirian-name\'>"+userName+"</p>
 <img src=\'"+Drupal.settings.publicpath+"/Birthday_Images/birthdayTemplate1.jpg\' style=\'width:250px;height:230px;\'>
 <img src=\'"+Drupal.settings.publicpath+"/Anniversary_Images/"+anniversaryCount+"Anniversary.jpg\' style=\'width:250px;height:250px;\'>
</div>";
 }
};
}(jQuery)); 
(函数($){
Drupal.behaviors.one\u time\u弹出窗口={
附加:功能(上下文、设置){
var celeType=Drupal.settings.one\u time\u popup.celeType;
卡片=”

生日快乐,结婚周年快乐

“+userName+”

"; } }; }(jQuery));
我还有一个例子

 cardTemplate1 = "<div class=\'cardTemplate\'><span class=\'birthdayImage\'></span><p class=\'wishes\'>Happy Birthday <span id=\'aspirian-name\'>"+userName+"</span> !</p><img src=\'"+Drupal.settings.publicpath+"/Birthday_Images/birthdayTemplate1.jpg\'></div>";
cardTemplate1=“

生日快乐”+用户名+!

”;

它显示没有转义单引号的正则表达式不匹配

您不需要转义单引号

您不需要转义单引号
您不能在双引号中包含多行字符串文字。如果您有ES6,您可以使用backticks获得多行模板字符串。请参见

双引号中不能包含多行字符串文字。如果您有ES6,您可以使用backticks获得多行模板字符串。请参见

请使用更多代码(包括正则表达式)更新您的答案。请使用更多代码(包括正则表达式)更新您的答案。什么错误?请在您的问题中包含此信息!什么错误?请在您的问题中包含此信息!