TCP (transmission control protocol) message matching method on Regular expression

The invention provides a TCP (transmission control protocol) message matching method based on Regular expression. The method comprises the following steps: reading all regular expression rules, and setting a matching rule list; sequentially matching TCP messages in a field-by-field mode according to a field sequence of the regular expression, namely traversing a corresponding matching rule list according to the current field content, removing matching rules which conflict with the current field content out of the matching rule list; if a corresponding matching rule is absent in the regular expression, the TCP message matching fails; if each field has a corresponding matching rule in the regular expression, the TCP message matching is successful, and the message is allowed to pass. The TCP message matching method has the advantages of high efficiency and high safety.