I'm using regex to replace image source urls in an html file. 

I want for example to replace `img/` with `<?= $folder ?>/img/`

The issue: 
When I run the regex multiple times it will replace `img/` again, creating:

```
<?= $folder ?>/<?= $folder ?>/img

```

..and so on. Is there a way to tell regex to replace `img/` if not already `<?= $folder ?>/img` ?

I am trying `/^(?:(?!<?= $folder ?>/img).)*$/` but not sure how to first match and check if that it doesn't already contain `<?= $folder ?>/img`