Answer the question
In order to leave comments, you need to log in
How to replace only part of a string found by reg. expression?
https://regex101.com/r/BZGwi8/1
is to replace ib.
But how to replace only part of the result found by the regular expression?
Answer the question
In order to leave comments, you need to log in
var str = "https://days.pravoslavie.ru/jpg/is847.jpg";
var regex = /(is)+([0-9]{1,})+([.])+([a-zA-Z]{2,})/;
console.log(str.replace(regex,str.match(regex)[0].replace(/is/,"ib")));
//https://days.pravoslavie.ru/jpg/ib847.jpg
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question