Use a scored grammar. For example, this scoring directive opcode: /$match_text1/ opcode: /$match_text2/ opcode: /$match_text3/ would return the opcode with the longest length, as opposed to which one matched first. Just look for the section "Scored productions" in the .pod documentation.