String matching uses finite automata to effectively search for patterns within text. A finite automaton represents a language as a set of strings and can test if a string matches by running it on the automaton. To perform string matching with a finite automaton, the pattern is represented as states in the automaton. The transition function is computed to define the state transitions for each alphabet symbol. The automaton is run on the text and checks for a transition to the final state to determine if the pattern was found. Real-world applications of finite automata include search engines, text editors, coke machines, and train track switches.