I have a preg match that is working as needed (returning mostly the proper information), but for some reason each printed line is missing the very last character (no matter if it is multiple words or different lengths). I've tried adjusting my regex but have only successfully broken it many ways so that it doesn't function at all. Current 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++;}
it should return a name (match1), and an item (match2) 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.
The 2nd issue I'm having with the same code is that I'd like it to only return the results if there is at least 1 capital letter in the 2nd match (it could be the first word, the last, or in multiples - the 2nd match may have 1 word or more). I have tried variations of adding A-Z but as I am still just dipping into php and particularly regex I'm missing the key to tell the server exactly what I mean. Any assist, pointers to newb friendly tutorials (though I think I may have found them all) would be greatly appreciated.
tia in advance.