1. A method comprising: generating a tree structure representing a string of characters; comparing a character from a data stream to a root node of the tree structure; activating a state machine if the character matches the root node of the tree structure; and comparing, with the state machine, subsequent characters from the data stream to subsequent nodes of the tree structure.