That's Python however, as I don't want to try and mess with this in some other language. But maybe someone can translate it to Lua for you. It needs to go into a plugin, and you'll need to replace the three words ('glass', 'and', and 'stonework') with the groups that you want to actually match. This is just an example of how it can be done though, and doesn't pretend to be unversal in any way. It also won't help if your text is broken up between two packets, in which case nothing that I can think of can help, save for redrawing the entire output window by hand.