我试图找到所有字符串有超过2个大括号块,即2个动态值,如{{data1}} {{data2}}之间的双引号
例如:
class="xyz level1 {{disabled}} what is the {{contentStyle}} result" 我试过了,但没有成功
(.*?{{){1,}
发布于 2017-08-09 08:22:05
你可以检查匹配的长度,这将给你关于有多少个大括号块的信息:
var p = /(\{\{.+?\}\})/g;
var str = "xyz level1 {{disabled}} what is the {{contentStyle}} result {{what}} is the";
var res = str.match(p); /* here res will either null or an array */
if(res && res.length > 2){
console.log("yes");
}https://stackoverflow.com/questions/45579671
复制相似问题