Answer the question
In order to leave comments, you need to log in
Can you help with regex?
It is necessary between two // `let str = "qwe//qwe";` to insert any text, but then this text can be replaced with another
Answer the question
In order to leave comments, you need to log in
const str = 'qwe//qwe';
const reg = /(qwe\/).*(\/qwe)/;
const replacement = 'hello, world!!';
const newStr = str.replace(reg, `$1${replacement}$2`);
let str = "qwe//qwe";
console.log(str.replace(/\/\//g, "/"+"любой текст"+"/"))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question