1. An apparatus including a processor for detecting a pattern in a data stream comprising: a pattern matching device for receiving the data stream, the pattern matching device comprising: at least one rule engine, said at least one rule engine operating under a plurality of state transition rules encoding a plurality of patterns, a first state transition rule including a wildcard state component and a wildcard input component, a second state transition rule including a wildcard state component and a specified input component, and a third state transition rule including a specified state component and a specified input component, the first, second and third rules having differing priorities; and at least one state transition rule including an output component indicating a pattern match, the apparatus arranged to pass the data stream to said at least one rule engine, and further arranged to output a signal indicating a pattern match when a state transition rule indicates a pattern match; and a pattern distribution device configured to receive patterns, to distribute the patterns across a plurality of pattern collections, and to convert each pattern collection into the plurality of state transition rules; wherein the pattern distribution device is configured, when distributing the patterns across the plurality of pattern collections, to distribute the patterns according to a commonality between patterns and a conflict between patterns; and wherein the conflict between patterns defines a substring of one pattern excluding a first character, as being a prefix of another pattern such that conflicting patterns defined as the conflict between patterns are distributed in a different plurality of pattern collections.