I need to create a function to replace
[li]text[/li]
into
<li>text</li>
This is the regex Im testing but nothing
$string="[li]A[/li] [li]B[/li] [li]C[/li] [li]D[/li]";
$pattern = "/[li](.*?)[\/li]/s";
$string = preg_replace($pattern, "$1", $string);
echo $string; //but returns: []A[/] []B[/] []C[/] []D[/]
but nothing, what Im doing wrong?
/\[li\](.*?)\[\/li\]/s[li]textwithout[/li]be altered? Can we assume that if[/li]is present it will be preceded by[li]? Is it just[li], or, could it be, say,[a]and[/a]?