Selective regex replacement with the maven-replacer-plugin

I’d like to use the maven-replacer-plugin to rename my javascript import statements in my index.html file.

However I would only like to do this where the path starts with app

index.html snippet

<!-- rename this one to app/something12345.js -->
<script src="app/something.js"></script>

<!-- leave this one as it is -->
<script src="vendor/angular.js"></script>

In my pom.xml so far I have this configuration for the maven-replacer-plugin


At the moment this will obviously replace all the .js matches.

Is there some magic incantation I can put in the <token> section to achieve this?

I managed to do this using the following


although in my real application I replaced 12345 with the ${buildNumber} variable, so the syntax was


which I hope might make the solution a bit more understandable