```js
var str = '%% %%s %s'.replace(/%([a-z%])/g, function(_, s){
  switch (s) {
    case '%':
      return '%'
    case 's':
      return '<string>'
  }
})
console.log(str);
```

```
% %s <string>
```

unless im missing a weirder case