Some page have inserted secret text and JS script on this page should get a value between two characters, for example, between characters @@. In this variant @@569076@@ - 569076 should receive.
Here is what i've tried:
var markup = document.documentElement.outerHTML;
var div = document.getElementById("textDiv");
div.textContent = markup.match(/@@([^@]*)@@/);
var text = div.textContent;
The problem is that the match function returns an array of matched values and textContent will only accept a string.
So you have to select which array item you want to use for the textContent assignment:
div.textContent = markup.match(/@@(\d+)@@/);
Note we selected the first captured item using the
 from the matches array.