A string matching system comprises a state transition table generator for generating a state transition table based on a matching condition described in a regular expression, and an automaton for including a state that makes a transition according to the state transition table generated by the state transition table generator; if, in the state transition table generated based on the matching condition, there exists no next transition destination state with respect to a current-state and input-characters tuple, the automaton makes a transition to the initial state without proceeding to read input characters.
Furthermore, the string matching system comprises a state transition table generator for generating a state transition table based on matching conditions described in a regular expression, and an automaton that makes a transition according to the state transition table generated by the state transition table generator; if no next-transition destination state with respect to a current-state and input-character tuple exists in the state transition table generated based on the matching condition, then the state transition table generator determines an exclusion character based on which the automaton make a transition to a predetermined state without proceeding to read input characters, to generate a state transition table.