1. A method for processing data for pattern matching, the method comprising: receiving a first sequence of data values; and generating, by at least one processor, a second sequence of data values based on the first sequence, one or more patterns, and a history of data values in the first sequence, with the second sequence having fewer data values than the first sequence and all subsequences in the first sequence that match at least one of the one or more patterns being represented in the second sequence, with generating the second sequence of data values comprising generating data values according to an associated buffer state corresponding to at least some of the first sequence of data values, the buffer state corresponding to fewer than or equal to a maximum number of data values, and outputting at least one of the data values corresponding to the buffer state to prevent overflow of the buffer state beyond the maximum number of data values.