Let's say I have the following text :
foo bar baz <!-- USERNAME --> <!-- ACCESS_KEY --> baz bar foo
<!--:USERNAME-->
<!-- eueuteh -->
-DarchetypeVersion=<!-- java-version --> -UserName=<!-- :USERNAME --> -DsauceAccessKey=<!-- ACCESS_KEY -->
What I want to do is replace <!-- USERNAME -->
with some other text. Unfortunately the regex I've created doesn't actually work as intended, and for example replaces the whole <!-- java-version --> -UserName=<!-- :USERNAME -->
expression. The first two occurences are replaced properly. Where is the mistake ?
Here's what I've got, testing in javascript console :
var re = new RegExp('(<!--)(.)*(USERNAME)(.)?(-->)');