AV1611 Posted October 11, 2008 Share Posted October 11, 2008 $pattern=array( "/\[link\](.*?)\[\/link\]/" ); $replace=array( "<a href=\"\\1\">\\1</a>" ); $str=preg_replace($pattern,$replace,$mystring); This is working good, but... How can I make the $pattern part case insensitive? Quote Link to comment https://forums.phpfreaks.com/topic/128004-solved-quick-preg_replace-question/ Share on other sites More sharing options...
wildteen88 Posted October 11, 2008 Share Posted October 11, 2008 by using the i pattern modifier. "/\[link\](.*?)\[\/link\]/i" Quote Link to comment https://forums.phpfreaks.com/topic/128004-solved-quick-preg_replace-question/#findComment-662830 Share on other sites More sharing options...
AV1611 Posted October 11, 2008 Author Share Posted October 11, 2008 Thanks, That did the trick. Can anyone point me to a good NOOB tutorial? I STILL can't get my head around regex Quote Link to comment https://forums.phpfreaks.com/topic/128004-solved-quick-preg_replace-question/#findComment-662916 Share on other sites More sharing options...
GingerRobot Posted October 11, 2008 Share Posted October 11, 2008 There should be one available on this site before too long. Quote Link to comment https://forums.phpfreaks.com/topic/128004-solved-quick-preg_replace-question/#findComment-662919 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.