darkfreaks Posted February 26, 2010 Share Posted February 26, 2010 i need help i need to match some bbcode :tester: then if it matches to redirect using the header function. Quote Link to comment https://forums.phpfreaks.com/topic/193434-matching-bbcode/ Share on other sites More sharing options...
darkfreaks Posted February 26, 2010 Author Share Posted February 26, 2010 $search=':tester:'; $re1='.*?'; # Non-greedy match on filler $re2='((?:[a-z][a-z]+))'; if (preg_match_all ("/".$re1.$re2."/is", $search, $text)) { header('http://www.mafiahitman.com/HOMO.php'); } is that efficient enough Quote Link to comment https://forums.phpfreaks.com/topic/193434-matching-bbcode/#findComment-1018374 Share on other sites More sharing options...
cags Posted February 26, 2010 Share Posted February 26, 2010 It doesn't look terribly efficient, but then you don't actually really describe what your attempting. Quote Link to comment https://forums.phpfreaks.com/topic/193434-matching-bbcode/#findComment-1018427 Share on other sites More sharing options...
darkfreaks Posted February 26, 2010 Author Share Posted February 26, 2010 i just need to know how i would match :tester: then if it matches to redirect. Quote Link to comment https://forums.phpfreaks.com/topic/193434-matching-bbcode/#findComment-1018628 Share on other sites More sharing options...
cags Posted February 26, 2010 Share Posted February 26, 2010 If it matches in what, if it is the only thing in a variable, if it's contained in the variable, if it's contained anywhere in the variable. if( strpos($input, ':tester:') === FALSE ) { // redirect } Quote Link to comment https://forums.phpfreaks.com/topic/193434-matching-bbcode/#findComment-1018629 Share on other sites More sharing options...
darkfreaks Posted February 26, 2010 Author Share Posted February 26, 2010 will that return :tester: then redirect or will it just redirect if it doesn't find it? Quote Link to comment https://forums.phpfreaks.com/topic/193434-matching-bbcode/#findComment-1018654 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.