changed to use maximal munch rule when multiple rules match