Answer the question
In order to leave comments, you need to log in
How to write a regular expression in php?
$text = '"i":"https://mylink.com/2634/2634441_200x200.jpg","l';
$pattern = "|\"i\":\"https://[^\"]+\/|is";
$text = preg_replace($pattern, "\"i\":\"http://newlink.com/", $text);
echo $text;
"i":"http://newlink.com/2634441_200x200.jpg","l
"i":"http://newlink.com/2634/2634441_200x200.jpg","l
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question