<?php $text = '[My Test URL|https://ww w.mywebsite.c om/t est?param=123]'; echo preg_replace_callback('/\[([^][|]*)\|([^][]+)]/', function($m) { return '<a href="' . str_replace(' ', '', $m[2]) . '">' . $m[1] . '</a>'; }, $text);
You have javascript disabled. You will not be able to edit any code.