improve regexp matching on string input ports