[Vuejs]-Change group of characters in a String

0👍

Here is the solution.
Please use regex expression instead of ’23’ string.

str = '236112456';
var result = str.replaceAll(/236/gi, '236.jpg').replaceAll(/1/gi, '1.jpg');
...

The result is "236.jpg1.jpg1.jpg2456". Is this not what you are looking for ?

Leave a comment