But I am unable to get it working.
Let's deconstruct what your regex ([a-zA-Z0-9]+@@?)(.+?)(.@@) says.
([a-zA-Z0-9]+@@?) match as many [a-zA-Z0-9] followed by a @ followed by optional @.
(.+?) any character as much as possible but fewer times.
(.@@) any character followed by two @. Now . consumes G and then @@. Hence THISSTRING is not completely captured in group.
Lookaround assertions are great but are little expensive.
You can easily search for such patterns by matching wanted and unwanted and capturing wanted stuff in a capturing group.
Regex: (?:[a-zA-Z0-9]@@)([^@]+)(?:@@\.)
Explanation:
(?:[a-zA-Z0-9]@@) Non-capturing group matching @@ preceded by a letter or digit.
([^@]+) Capturing as many characters other than @. Stops before a @ is met.
(?:@@\.) Non-capturing group matching @@. literally.
Regex101 Demo
Javascript Example
var myString = "a125A@@THISSTRING@@.test123";
var myRegexp = /(?:[a-zA-Z0-9]@@)([^@]+)(?:@@\.)/g;
var match = myRegexp.exec(myString);
console.log(match[1]);
([a-zA-Z0-9]+@@)(.+?)(@@\.).