Given a string, how can I identify the string has a colon in between a colon and a semi-colon?
For example, I want to identify that the following has a : in between : and ;. If this is the case, I want to replace the colon in the middle.
background-image: url('http://google.com/img.jpg');"
I can’t come up with a regex for the life of me. I can only match the whole url('http://google.com/img.jpg'). What regex can I use that can do this for me?
$pattern = '';
$matched = preg_replace($pattern, '|__|', $string);
1 Answer