Gratisites
asked on
PHP/Regex Issue with Long Strings
I'm parsing bbcode in a news application I'm building so my staff can easily add markup without knowing any HTML. In my testing I'm running into an issue where if the content inside a quote tag is too long (not sure of the exact byte length of the string but its only a few paragraphs, nothing extreme) the function doesn't output anything. I'm not seeing any errors, just a blank space where the parsed content should be.
If the flag is Usi and the string is long it works properly, if the flag is Usi and the string is short it blows up. The reverse is true for si.
Here's the snippet in question.
If the flag is Usi and the string is long it works properly, if the flag is Usi and the string is short it blows up. The reverse is true for si.
Here's the snippet in question.
$search = array(
'@\[(?i)quote\](.*?)\[/(?i)quote\]@si'
);
$replace = array(
'<div class="quote">\\1</div>'
);
$str = preg_replace($search , $replace, $string);
Are you able to post the data (or an example of it) that causes the problem?
ASKER
Sure, I'm seeing the problem quoting this interview for a video game:
[quote][b]Q. Can you talk a little bit more about the Halls of the Dead?[/b]
JW: The idea is when you lose a hardcore character, you don't really want that character to go away forever and you don't want it to take up a character slot.
Well, it'll probably be optional where you can choose to free up the slot by archiving the dead character into the Halls of the Dead. You'll see the name, the gear on death, and maybe some other stuff.[/blizzard]
[blizzard][b]Q. Can you talk a little bit more about the Halls of the Dead?[/b]
JW: The idea is when you lose a hardcore character, you don't really want that character to go away forever and you don't want it to take up a character slot.
Well, it'll probably be optional where you can choose to free up the slot by archiving the dead character into the Halls of the Dead. You'll see the name, the gear on death, and maybe some other stuff.
[b]Q. Is it actually part of the ui?[/b]
JW: It's part of your profile, so you just need to right click on your character to open up your profile and it tells you all about your character, your achievements and your progression.
[b]Q. When you say Halls of the Dead I just imagined a hall where you walk around with statues of your characters.[/b]
JW: That would be awesome, but it's probably just going to be in the UI. Maybe someday it'll be a big awesome hall!
[b]Q. Now that all spells are dependent on weapon speed and damage, are you getting rid of spell damage and increased cast rate?[/b]
JW: We are getting rid of increased cast rate, and increased weapon rate will replace it. Spell damage was a stat that only really appeared to the Witch Doctors and Wizards, we probably made this change for 2 reasons. The major one was we found casters were not valuing their weapons, that was a big problem with Diablo 2. The second one was Witch Doctor and Wizard randomly generated affixes were very confusing, our testers were coming back with questions like "What's the math on this, when you say 20% increased damage does it apply to base damage, to spell damage?" If you can't understand it and can't understand which one is better than the other then that's a bad thing.
[b]Q. What did you have to change in order to make followers viable in the end-game?[/b]
JW: The big one is we have to do a multiplier on your base stats, because you don't have the same item options as your character.
[b]Q. So, do we still have to sacrifice passives to buff our followers? I remember back in the press event you said that.[/b]
JW: Oh, that what just an idea I had at the time, you won't have to sacrifice passives.
[b]Q. What about the unattuned runestones on the homepage?[/b]
JW: Where is that system at? It's... interesting. It's not great, as one of our people said to us "It's kind of a new kind of horrible" because it just had different problems. It's really the last big system we have, the last big problem to solve.
[b]Q. What's the biggest thing you've learned since the beta was released?[/b]
JW: Most of the beta has been useful to us from a technical standpoint, so there's not a lot of tuning stuff that the beta tells us about. The vast majority of feedback we've received has been "it's too easy". We really wanted the beta to test our hardware.
JAB: In the industry, it's really hard to test load and infrastructure without the players. Players play differently and are smart, our testing bots are not.
[b]Q. Do you have to play through softcore to unlock hardcore?[/b]
JW: Oooh, good question, yes, you will have to play through to a certain point to unlock hardcore mode, I think it's through normal difficulty after you kill the end boss. I'm like 90% sure, so we could change our minds.
[b]Q. We had a discussion on our forums about the color of resource systems, specifically the Demon Hunter and Monk, everyone got new resource systems other than the Witch Doctor who is stuck with mana. The same old blue orb, what are your thoughts on changing that to something more Witch Doctery like green?[/b]
JW: We like the Witch Doctor one the most, the biggest problem with green is it's poison. So, if we put it in there that's going to be the reaction people have, like is that my poison vial... have I been poisoned? Some people have suggested we make the Monk orb yellow, like the urine ball as opposed to the jizz ball. One of the suggestions we got for the Demon Hunter was to make it black... but that won't work since you just won't see it, and white is a massive contrast. If you do that you'll suddenly have a resource that you just can't see. So we were comfortable with the red and blue, they work better.
[b]Q. Surely you have the resources to just add a new color to the spectrum.[/b]
JW: Umm, we have the power, but we don't have the will. (looks to JAB) You know it's true.
JAB: I don't know that.
[b]Q. Are we going to be forced to use Real ID to add friends?[/b]
JW: No, and that's all I can say. We do have some plans; we aren't going to force you to be Real ID friends.
[b]Q. With the banner system in Diablo III, are we going to start out with everything we see in the beta unlocked, or will we have to gain achievements to unlock them.[/b]
JW: It's just there for you to see, you'll have to gain achievements to unlock those.
[b]Q. Do you have a number of achievements yet?[/b]
JW: Umm, no.
JAB: 12?
JW: No.
JAB: 13?
JW: More than 13.
JAB: 15?
JW: More than 15, would you like to take another shot?
JAB: 16.
JW: You're getting closer, very slowly. It'll be in the hundreds.
JAB: That was my next guess.
[b]Q. How many hours do you anticipate the average player will have to invest to hit level 60 in Diablo III?[/b]
JW: This is a really hard question to answer, people ask me this all the time. The answer depends on how insane you are... I'm gonna say... I'm not even gonna guess, because if I do I know that's going to come back and haunt me. We're not really concerned about making 1-60 some ridiculously long grind. We're not douchebags, it'll be based upon what feels good.
[b]Q. Compared to Diablo 2?[/b]
JW: Again, it's speculation that will come back to haunt me. It'll probably be shorter than Diablo II, but D2 also didn't have an end-game.
[b]Q. With the rich lore and races of World of Warcraft, have you thought of incorporating some of that into Diablo III such as Dwarves?[/b]
JW: No, one of the things that is driving the Diablo universe is that it's a very human-centric place. Anything that isn't human is pretty much bad.
[b]Q. Why isn't Diablo III supporting mods?[/b]
JW: There's a variety of reasons for that, one of the things people say a lot is "Oh, mods are such a hallmark of the previous games!" and I say... really?. There are mods, and there has been some developer support for those efforts, but that's not the same as us directly supporting it. To do that, we release tool sets and treat it like a product. We decided that the effort it would take to make mod tools would be a monumental effort. I know it seems like we're Blizzard and we have unlimited resources but we don't - we had to figure out our priorities to get the game out.[/quote]
ASKER
Delete the rogue [blizzard] tag in there, I had renamed blizzard to quote to make it more understandable for you guys but my sample data still had part of it.
would it be possible to set the flag variables using strlen? it if the strlen is too long add the U?
$search = array(
'@\[(?i)quote\](.*?)\[/(?i)quote\]@'.(strlen($string)>500?'U':'').'si'
);
$replace = array(
'<div class="quote">\\1</div>'
);
Did you know that when the U flag is set, the ? in .*? makes the .* greedy? You don't want that to be the case I think, so you're better not to use that flag (and just continue to use .*?).
Getting the greediness wrong could cause the problem in some cases. Perhaps try this, and see if it works in all cases. Note that I've removed the embedded (?i) modifiers, as you've already got the i modifier after the 2nd pattern delimiter.
<?
$search = array(
'@\[quote\](.*?)\[/quote\]@si'
);
$replace = array(
'<div class="quote">\\1</div>'
);
$str = preg_replace($search , $replace, $string);
Note that with Derokorian's solution, if you have 2 pairs of quote tags like:
blah [quote]Q. Can you[/quote]Q. Can you[quote]Q. Can you[/quote]foo
and the string was longer than 500 chars, you'd get the outermost 2 tags replaced like this:
blah <div class="quote">Q. Can you[/quote]Q. Can you[quote]Q. Can you</div>foo
because the U modifier makes .*? greedy.
ASKER
$string has the whole new post so the strlen solution isn't really practical. I tried your solution TerryAtOpus but it's still outputting nothing, doesn't appear to have fixed it.
I'm not really good with regex at all so I'm open to try any other theories out there to fix this.
I'm not really good with regex at all so I'm open to try any other theories out there to fix this.
ASKER
What I mean is there is a whole whack of other stuff other than just what's in the quote tag, so strlen isn't just calculating the length of what's inside quote but everything else too.
I've already seen the problem you described TerryAtOpus with the greedy flag, so yeah I understand.
I've already seen the problem you described TerryAtOpus with the greedy flag, so yeah I understand.
Yeah I don't quite understand greedy/non-greedy so I just modified the regex the OP posted. Sorry I couldn't be of more help!
@Derokorian
Greedy
Ungreedy
Yeah I don't quite understand greedy/non-greedyGiven:
$data = "HELLO WORLD";
$pattern = "H.*L"; // Greedy
$pattern = "H.*?L"; // Ungreedy
Greedy
$result = "HELLO WORL";
Ungreedy
$result = "HEL";
WOW! I've never seen it explained oh so simply. That was perfect kaufmed, and suddenly it just clicks.
Not a problem. Glad it helped  = )
ASKER
Spent the last few hours trying out different things, nothing seems to work... I always have the strangest problems when it comes to regex =/
As a sanity check, can you try these kinds of tests -
Try this to see whether a simpler replacement works:
$search = '@\[quote\]@si';
$replace = '<div class="quote">;
$str = preg_replace($search , $replace, $string);
(or simplify further until it works)
Also, sometimes these kinds of issues can be caused by the source data being different to what the pattern expects, such as:
[quote ] or [quote style="foo"]
instead of
[quote]
Once you've got it working, build up the complexity one step at a time until it fails, and then examine why it might have happened.
Missed a quote on this line:
$replace = '<div class="quote">';
$replace = '<div class="quote">';
ASKER
Did some testing and I can put 996 of the letter "a" (no spacing) fine, but once I have a 997th character it craps out, this is with TerryAtOpus' code earlier and as well with my original code.
Which version of PHP are you running? Might be worth checking bug reports for that version.
ASKER
5.3.8
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
I can't seem to reproduce it either  : \
Untitled.png
<html>
<head>
<link rel="Stylesheet" href="site.css" />
</head>
<body>
<pre>
<?php
$string = <<<HERE
[quote]aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa[/quote]
HERE;
$search = array(
'@\[quote\](.*?)\[/quote\]@si'
);
$replace = array(
'<div class="quote">\\1</div>'
);
$str = preg_replace($search , $replace, $string);
echo $str;
?>
</pre>
</body>
</html>
Untitled.png
I'm also unable to reproduce this. Made this to test:
<?php
// Build the large sample
$str = 'some non quoted text [quote]';
for( $i=1;$i<1000;$i++ ) {
$str .= 'aaaaaaaaaa';
}
$str .= '[/quote] some more non quoted text';
$search = array(
'@\[quote\](.*?)\[/quote\]@si'
);
$replace = array(
'<div class="quote">\\1</div>'
);
$str = preg_replace($search , $replace, $str);
echo $str;
Do you really need a preg_replace for this? Could you not simply do two str_replace's: one for occurrences of "
" and one for occurrences of ""? Granted it's not ideal (from a parsing point of view), but it might solve your problem in the short term.
kaufmed, the EE Comment box has interpreted your
[quote]
tags as quotes I believe... (but I suspect the point made is still clear)
LOL.  I wasn't paying attention. It certainly did  = D
Just so there's no confusion:
Do you really need a preg_replace for this? Could you not simply do two str_replace's: one for occurrences of "[ quote ]" and one for occurrences of "[ /quote ]"
Just so there's no confusion:
Do you really need a preg_replace for this? Could you not simply do two str_replace's: one for occurrences of "[ quote ]" and one for occurrences of "[ /quote ]"
P.S.
Thanks Terry!
Thanks Terry!
Here's my 0.02 Euros... Moving parts start at line 108. Â You can see it in action on my server here:
http://www.laprbass.com/RAY_temp_gratisites.php
Best to all, ~Ray
http://www.laprbass.com/RAY_temp_gratisites.php
Best to all, ~Ray
<?php // RAY_temp_gratisites.php
error_reporting(E_ALL);
echo "<pre>";
// THE TEST DATA FROM THE POST AT EE. NOTE THE BLIZZARD TAGS WRAPPED IN ITALICS
$str = <<<HEREDOC
[quote][b]Q. Can you talk a little bit more about the Halls of the Dead?[/b]
JW: The idea is when you lose a hardcore character, you don't really want that character to go away forever and you don't want it to take up a character slot.
Well, it'll probably be optional where you can choose to free up the slot by archiving the dead character into the Halls of the Dead. You'll see the name, the gear on death, and maybe some other stuff.[i][/blizzard]
[blizzard][/i][b]Q. Can you talk a little bit more about the Halls of the Dead?[/b]
JW: The idea is when you lose a hardcore character, you don't really want that character to go away forever and you don't want it to take up a character slot.
Well, it'll probably be optional where you can choose to free up the slot by archiving the dead character into the Halls of the Dead. You'll see the name, the gear on death, and maybe some other stuff.
[b]Q. Is it actually part of the ui?[/b]
JW: It's part of your profile, so you just need to right click on your character to open up your profile and it tells you all about your character, your achievements and your progression.
[b]Q. When you say Halls of the Dead I just imagined a hall where you walk around with statues of your characters.[/b]
JW: That would be awesome, but it's probably just going to be in the UI. Maybe someday it'll be a big awesome hall!
[b]Q. Now that all spells are dependent on weapon speed and damage, are you getting rid of spell damage and increased cast rate?[/b]
JW: We are getting rid of increased cast rate, and increased weapon rate will replace it. Spell damage was a stat that only really appeared to the Witch Doctors and Wizards, we probably made this change for 2 reasons. The major one was we found casters were not valuing their weapons, that was a big problem with Diablo 2. The second one was Witch Doctor and Wizard randomly generated affixes were very confusing, our testers were coming back with questions like "What's the math on this, when you say 20% increased damage does it apply to base damage, to spell damage?" If you can't understand it and can't understand which one is better than the other then that's a bad thing.
[b]Q. What did you have to change in order to make followers viable in the end-game?[/b]
JW: The big one is we have to do a multiplier on your base stats, because you don't have the same item options as your character.
[b]Q. So, do we still have to sacrifice passives to buff our followers? I remember back in the press event you said that.[/b]
JW: Oh, that what just an idea I had at the time, you won't have to sacrifice passives.
[b]Q. What about the unattuned runestones on the homepage?[/b]
JW: Where is that system at? It's... interesting. It's not great, as one of our people said to us "It's kind of a new kind of horrible" because it just had different problems. It's really the last big system we have, the last big problem to solve.
[b]Q. What's the biggest thing you've learned since the beta was released?[/b]
JW: Most of the beta has been useful to us from a technical standpoint, so there's not a lot of tuning stuff that the beta tells us about. The vast majority of feedback we've received has been "it's too easy". We really wanted the beta to test our hardware.
JAB: In the industry, it's really hard to test load and infrastructure without the players. Players play differently and are smart, our testing bots are not.
[b]Q. Do you have to play through softcore to unlock hardcore?[/b]
JW: Oooh, good question, yes, you will have to play through to a certain point to unlock hardcore mode, I think it's through normal difficulty after you kill the end boss. I'm like 90% sure, so we could change our minds.
[b]Q. We had a discussion on our forums about the color of resource systems, specifically the Demon Hunter and Monk, everyone got new resource systems other than the Witch Doctor who is stuck with mana. The same old blue orb, what are your thoughts on changing that to something more Witch Doctery like green?[/b]
JW: We like the Witch Doctor one the most, the biggest problem with green is it's poison. So, if we put it in there that's going to be the reaction people have, like is that my poison vial... have I been poisoned? Some people have suggested we make the Monk orb yellow, like the urine ball as opposed to the jizz ball. One of the suggestions we got for the Demon Hunter was to make it black... but that won't work since you just won't see it, and white is a massive contrast. If you do that you'll suddenly have a resource that you just can't see. So we were comfortable with the red and blue, they work better.
[b]Q. Surely you have the resources to just add a new color to the spectrum.[/b]
JW: Umm, we have the power, but we don't have the will. (looks to JAB) You know it's true.
JAB: I don't know that.
[b]Q. Are we going to be forced to use Real ID to add friends?[/b]
JW: No, and that's all I can say. We do have some plans; we aren't going to force you to be Real ID friends.
[b]Q. With the banner system in Diablo III, are we going to start out with everything we see in the beta unlocked, or will we have to gain achievements to unlock them.[/b]
JW: It's just there for you to see, you'll have to gain achievements to unlock those.
[b]Q. Do you have a number of achievements yet?[/b]
JW: Umm, no.
JAB: 12?
JW: No.
JAB: 13?
JW: More than 13.
JAB: 15?
JW: More than 15, would you like to take another shot?
JAB: 16.
JW: You're getting closer, very slowly. It'll be in the hundreds.
JAB: That was my next guess.
[b]Q. How many hours do you anticipate the average player will have to invest to hit level 60 in Diablo III?[/b]
JW: This is a really hard question to answer, people ask me this all the time. The answer depends on how insane you are... I'm gonna say... I'm not even gonna guess, because if I do I know that's going to come back and haunt me. We're not really concerned about making 1-60 some ridiculously long grind. We're not douchebags, it'll be based upon what feels good.
[b]Q. Compared to Diablo 2?[/b]
JW: Again, it's speculation that will come back to haunt me. It'll probably be shorter than Diablo II, but D2 also didn't have an end-game.
[b]Q. With the rich lore and races of World of Warcraft, have you thought of incorporating some of that into Diablo III such as Dwarves?[/b]
JW: No, one of the things that is driving the Diablo universe is that it's a very human-centric place. Anything that isn't human is pretty much bad.
[b]Q. Why isn't Diablo III supporting mods?[/b]
JW: There's a variety of reasons for that, one of the things people say a lot is "Oh, mods are such a hallmark of the previous games!" and I say... really?. There are mods, and there has been some developer support for those efforts, but that's not the same as us directly supporting it. To do that, we release tool sets and treat it like a product. We decided that the effort it would take to make mod tools would be a monumental effort. I know it seems like we're Blizzard and we have unlimited resources but we don't - we had to figure out our priorities to get the game out.[/quote]
HEREDOC;
// DEFINE THE TAG REPLACEMENTS
$tags = array
( '[b]' => '<b>'
, '[/b]' => '</b>'
, '[quote]' => '<quote>'
, '[/quote]' => '</quote>'
, '[i]' => '<i>'
, '[/i]' => '</i>'
)
;
// PERFORM THE REPLACEMENTS
$out = $str;
foreach ($tags as $bbc => $htm)
{
$out = str_replace($bbc, $htm, $out);
}
// SHOW THE WORK PRODUCT
echo htmlentities($out);
// SHOW THE HTML STRING
echo "</pre>";
echo nl2br($out);