Here is my problem. This is probably a simple solution. I have a regex that I use to replace BBCode. What I have now does not work like that.
<?php
$input_string = '[url=www.test.com]Test[url]';
$regex = '/\[url=(.+?)](.+?)\[\/url]/is';
$replacement_string = '<a href="$1">$2</a>';
echo preg_replace($regex, $replacement_string, $input_string);
?>
Currently, the original $ input_string is being output, while I would like it to output the following.
<a href="www.test.com">Test</a>
What am I missing?
source
share