RaythMistwalker Posted November 11, 2011 Share Posted November 11, 2011 Ok i have this as bbcode regex: $bbreplace = array ( "/\[b\](.*?)\[\/b\]/is" => "<b>$1</b>", "/\[u\](.*?)\[\/u\]/is" => "<u>$1</u>", "/\[url\=(.*?)\](.*?)\[\/url\]/is" => "<a href='$1'>$2</a>", "/\[img\]http://(.*?)\[\/img\]/is" => "<img src='$1'>", "/\[s\](.*?)\[\/s\]/is" => "<s>$1</s>", "/\[i\](.*?)\[\/i\]/is" => "<i>$1</i>", "/\[color=(.*?)\](.*?)\[\/color\]/is" => "<font color='$1'>$2</font>", "/\[size=(.*?)\](.*?)\[\/size\]/is" => "<font size='$1'>$2</font>", "/\[list\](.*?)\[\/list\]/is" => "<ul>$1</ul>", "/\[list=1\](.*?)\[\/list\]/is" => "<ol>$1</ol>", "/\[\*\](.*?)/i" => "<li>$1</li>" ); $PostText = preg_replace(array_keys($bbreplace), array_values($bbreplace), $PostText); Now, this works PERFECTLY apart from 1 thing. If I use the [ list] then [ *] it does it like so: Any ideas? Edit: I have checked multiple skins and it isn't a skin issue. Quote Link to comment https://forums.phpfreaks.com/topic/250909-almost-there/ Share on other sites More sharing options...
xyph Posted November 11, 2011 Share Posted November 11, 2011 This has to do with quantifiers. Don't PM me asking to look at a specific thread, please. Quote Link to comment https://forums.phpfreaks.com/topic/250909-almost-there/#findComment-1287401 Share on other sites More sharing options...
RaythMistwalker Posted November 11, 2011 Author Share Posted November 11, 2011 What are quantifiers? And I apologize but I never even realized that was against the rules since I had literally just deleted about 10 PM's recieved a year ago where people were asking me for help. But it is slightly frustrating when I request help on a forum where usually I get help no problem, and no one even bothers to reply when I get the same problem for a week+ straight. Quote Link to comment https://forums.phpfreaks.com/topic/250909-almost-there/#findComment-1287432 Share on other sites More sharing options...
xyph Posted November 11, 2011 Share Posted November 11, 2011 You can get an automated response to questions like that using tools like Google. You don't need someone to give the answer to you. This is a forum for self-made code. We're not here to adjust your copied code to work properly. If you produced that wall of RegEx up there, you'd know what a quantifier was, or the name would at least be familiar. If you can't find the quantifier in /\[\*\](.*?)/i , I do not believe you wrote it. BTW - You are not entitled to help - you are entitled to ask for help. If you get it, then be appreciative. If you don't, and others around you are, perhaps there's an issue with your question. Please don't become frustrated if your thread gets ignored. Quote Link to comment https://forums.phpfreaks.com/topic/250909-almost-there/#findComment-1287449 Share on other sites More sharing options...
RaythMistwalker Posted November 11, 2011 Author Share Posted November 11, 2011 I actually did write it I just never knew they were called Quantifiers. My friend started me off with the bold tags and I went from their adjusting on where people can input. Quote Link to comment https://forums.phpfreaks.com/topic/250909-almost-there/#findComment-1287487 Share on other sites More sharing options...
xyph Posted November 12, 2011 Share Posted November 12, 2011 No, you tried to modify someone's code you didn't fully understand. If you understood, you wouldn't need help with such a minor issue. That's why I'm not just giving you solution now - when you try and modify that, you'll end up back here when something doesn't work. Quote Link to comment https://forums.phpfreaks.com/topic/250909-almost-there/#findComment-1287659 Share on other sites More sharing options...
.josh Posted November 14, 2011 Share Posted November 14, 2011 perhaps there's an issue with your question. Please don't become frustrated if your thread gets ignored. We have stickies for a reason. Contrary to the belief of some people, they are not there so that we can be assholes on power trips. They are there because we know from a lot of experience trying to help people that we need certain info in order to help with a problem, and that usually when a person asks for help, they rarely know how to even ask for that help. It's kind of hard to know what the problem really is when you didn't properly explain the problem in the first place. You show your regex, which is good. But then you point at two of the array entries and show a picture of a list. You did not explain what the problem actually is. My best guess is that you're saying the bullet points aren't lined up properly but it's only a guess. You failed to show the subject, the content you are trying to perform the regex on. Nor did you show what the preg_replaces are doing vs. what you want it do. Also, if the issue is that the bullets aren't lined up properly, it's probably not even a regex issue, but a styling issue (css). Quote Link to comment https://forums.phpfreaks.com/topic/250909-almost-there/#findComment-1287999 Share on other sites More sharing options...
xyph Posted November 14, 2011 Share Posted November 14, 2011 The issue is the values are being echo'ed outside of the <li></li> tags. This is because he's used a lazy quantifier at the end of his RegEx. If you haven't told the RegEx to match something after a lazy quantifier, it won't match anything. That's how it works His biggest issue was wondering why it was outputting improperly without viewing the source of the page. Quote Link to comment https://forums.phpfreaks.com/topic/250909-almost-there/#findComment-1288164 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.