You could use anchors to assert the start ^ and the end $ of the line and match zero or more times any character .* or if there must be at least one character your might use .+
^%%.*%%$
Or instead of .* you could add your character class [a-zA-Z0-9]+ which will match lower and uppercase characters and digits or use the \w+ which will match a word character.
Note that the character class [a-zA-Z0-9] does not match an underscore and \w does.
If you want to find multiple matches in a string you might use %%\w+%%. This will also match %%HELLO_WOLD%% in %%%%%HELLO_WOLD%%%.
If there should be only 2 percentage signs at the beginning and at the end, you could use a positive lookahead (?= and positive lookbehind (?<= to assert that what is before and after the 2 percentage signs is not a percentage sign or are the start ^ or end $ of the string.
(?<=^|[^%])%%\w+%%(?=[^%]|$)