正则表达模式[#[#Hello]#]在JavaScript中匹配


var str1 = "hello <span contenteditable="false" class="underlineText hashtags hello">hello<span style="display:none;"> [#[#hello]#] [#[#hi]#]  [#[#welcome]#]</span></span>"
var arr = textToPost.match(/#^[a-zA-Z0-9]/g)

我想提取与此模式匹配的字符串[#[# *]#]。

尝试此正则表达式,它与我一起使用

var reg = /[[#[a-zA-Z0-9]+]#]/ig;

var str1 = "hello hello [#[#hello]#] [#[#hi]#] [#[#welcome]#]";
var reg = /[[#[a-zA-Z0-9]+]#]/ig;
var arr = str1.match(reg);
console.log(arr)

最新更新