Issue #1140 optimize prefix/suffix testing in the message matcher