CS110 Chapter Notes - Chapter 5: Finite-State Machine, Regular Expression, Eval
Document Summary
This document is dedicated to discussing about the fundamental role of finite state machine (fsm) in regular expression pattern recognition. In terms of lay-man words, regular expression (regex) is a systematic approach to define the pattern of words or strings. First, it involves all literals i. e. letters, digits and other non-alphanumeric symbols (i. e. #, ~, !, =, etc. ). Square brackets i. e. [] are used to group items together and they imply to any one of the items enclosed, whereas round brackets i. e. () are used to group different patterns together. literals, which when not escaped bring special. ), when not escaped, refers to all possible symbols. When symbol ^ is used, it refers to the first occurrence in a line or sentence. Alternatively, when a regular expression ends with a dollar ($) sign, it refers to the last occurrence in a line or sentence.