Reputation: 171
the string contains a value like this:
my string [[ [[test1]] test2 ]] other text
How I can get a values test1
and test2
in a different variables?
I tried!
var test = "my string [[ [[test1]] test2 ]] other text";
var reg = /[^\[\]]*[\w ]+(?=\])/i;
var reg2 = /\]\]\s*(.*)\s*\]\]/i;
result = reg2.exec(test);
alert(result);
The second regular I've made by myself, but it's still not the answer, it's returns me an array. So how to make it only a one value instead of whole array?
Upvotes: 0
Views: 580