-2
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)

I want to extract string which matches this pattern [#[# * ]#] .

VLAZ
  • 26,331
  • 9
  • 49
  • 67

1 Answers1

0

Try this regular expression , it works with me

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)
mostafa tourad
  • 4,308
  • 1
  • 12
  • 21