I should point out that I've never done this. There are mods out there that do do it and they are probably a good place to look. It appears though that the event is "CHAT_MSG_LOOT" and its arg1 is the whole chat message, parse it with e.g.
Code:
local name, roll, item
name, roll, item = arg1:match((LOOT_ROLL_ROLLED:gsub("%d","%s")):format("(.+)","(.+)",".+",".+",".+",".+","(.+)",".+"))
if not name then
name = UnitName("player")
roll, item = arg1:match((LOOT_ROLL_ROLLED_SELF:gsub("%d","%s")):format("(.+)",".+",".+",".+",".+","(.+)",".+"))
end
if not roll then return end
(YMMV, that code is *very* untested
)