Jump to content

missing character at end of match?


Braet

Recommended Posts

have a preg match that is working as needed, printing what I need it to as well, but for some reason each printed line is missing the very last character.  I've tried adjusting my regex but have only successfully broken it many ways:

[code]preg_match_all("/The (.+?) drops (.+?)[^, which you pick up]\./", $data, $loot);
$totLoots = (count($loot[1]) -1);
$i2 = 0;
while ($i2 <= $totLoots)
{$row=$i2+1;
if ($row % 2)
{echo "<TR><TD>".$loot[1][$i2]."</TD><TD>".$loot[2][$i2]."</TD></TR>";}
else
{echo "<TR><TD CLASS=\"one\">".$loot[1][$i2]."</TD><TD CLASS=\"one\">".$loot[2][$i2]."</TD></TR>";}
$i2++;;}[/code]

it should return a name, and an item when there is a period after the item - and ignore it if it then goes on to say ', which you pick up' prior to the period.  It is returning the information, just cutting off the very last letter of the item.

tia in advance.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.