Braet Posted August 20, 2006 Share Posted August 20, 2006 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. Quote Link to comment Share on other sites More sharing options...
effigy Posted August 21, 2006 Share Posted August 21, 2006 Please provide an example of input, and the desired output.You are misusing a characters class. [tt][^, which you pick up][/tt] Means any one character that is not a comma, space, w, h, i, c, y, o, u, p, or k. Quote Link to comment 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.