<?php $input = "[link=xxx]xxx[/link] [link=yyy][/link]"; echo preg_replace_callback('/\[link=(.*?)\](.*?)\[\/link\]/', function ($m) { return "<a href=\"$m[1]\">" . (strlen($m[2]) ? $m[2] : $m[1]) . '</a>'; }, $input);
You have javascript disabled. You will not be able to edit any code.