How to replace the first occurence with replaceRE function

I need replace the first h2 with some extra attributes assigned to it.

Is it possible to replace only the first h2 with function replaceRE?


You need to know that the format for the regexp used is PCRE (noted in the docs) and then searching for “PCRE replace first occurence” brings some results… have a look if the answer(s) to this one help: