added emacsRex method and a bit of parsing