naive string matcher fixed to match last pattern in string