i have a quote set up i made that replaces the blockquote of html that's been deprecated. issue is that the preg replacement doesn't work on nested quotes. not quite sure why. if anyone can tell me why and help me fix it, i would appreciate that.current php preg search:[php # add quotes
$postcode=preg_replace('|\[/quote]|i', '<hr /></div>', $postcode);
$postcode=preg_replace('|\[quote(=(.*))(?U)]|i', '<div class="quote">Quote \2<hr />', $postcode);result can bee seen in this thread:http://www.findyourdesire.com/forums.php?fid=4&tid=13 (currently the last post has got a nested one)
thanx in advance for the help
ps- an aside. i have something else i'm doing and using sessions there. just as question since i'm not used to sessions, is my understanding that any session variable that gets registered i can access via $variable instead of $_SESSION['variable']?
preg issue
Moderator: General Moderators
I think the problem is that RegEx tend to find the longest possible match.
Have a look at this page - which actually is for sed, but it uses the same RegEx
http://www-106.ibm.com/developerworks/l ... -sed2.html
Look out for the "Regexp snafus"; should be pretty much the same situation as yours
Have a look at this page - which actually is for sed, but it uses the same RegEx
Look out for the "Regexp snafus"; should be pretty much the same situation as yours