-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 [#[# * ]#] .

Dmitry
  • 6,196
  • 14
  • 37
  • 37

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
  • 3,988
  • 1
  • 10
  • 18