Abstract: A dynamic pattern matching system (DPRS) for a communication system is disclosed. The DPRS enables the command processor within the communication system to be flexible, permitting commands and their associated responses to be added, deleted and changed on the fly while the communication system is operative. A user designs a command set and constructs a trap definition file. This trap definition file is read by the DPRS during initialization and a trap chain is constructed. The trap chain is a linked list of all the traps constituting the command set. Traps, however, can be added and deleted on the fly via commands from the remote host or entered by a user via the keyboard or menus. The DPRS can be used as a tool to dynamically alter the behavior of an existing host application communication system. The DPRS can function as a stand alone flexible command processor or can work in parallel or serial fashion with a conventional command processor.