Design of finite state machines from regular expressions and their application to the pattern recognition problem