I have a line of text which is like:

```
    Hi %this% is the %text% I was talking about.

```

I want to replace `%this%` and `%text%` with some other text. I am using this regex:

```
str.replace(/(%)(.*)(%)/g, "something")

```

But this replaces **three** strings `%this%`, `%text%` and also `% is the %`. Is there any flag to let `/g` start afresh after the `%` ending tag and not count it as the next starting tag ?