GeorgeMoney Posted September 23, 2006 Share Posted September 23, 2006 Is it possible to use a function in the regex itself? this doesnt work:[code]$datr = preg_replace("/\[SC\](.*)\[\/SC\]/i", '<a name="'.myurlen("$1").'"></a>', $datr);[/code] Link to comment https://forums.phpfreaks.com/topic/21799-functions-in-regex/ Share on other sites More sharing options...
extrovertive Posted September 24, 2006 Share Posted September 24, 2006 preg_replace_callback Link to comment https://forums.phpfreaks.com/topic/21799-functions-in-regex/#findComment-97572 Share on other sites More sharing options...
wildteen88 Posted September 24, 2006 Share Posted September 24, 2006 Or use the [b]e[/b] pattern modifier:[code]$datr = preg_replace("/\[SC\](.*)\[\/SC\]/ie", "'<a name=\"' . myurlen('$1') . '\"></a>'", $datr);[/code] Link to comment https://forums.phpfreaks.com/topic/21799-functions-in-regex/#findComment-97641 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.