Regular Expressions is a an example of a Regular Language

This is a language to specify and discover patterns in strings.
Cheatsheet.

In Java

  • Find strings
  • Uses a pattern to compile a string pattern into a recognizer (a program that scans input and checks for desired pattern)
  • Uses a matcher to apply Pattern to a string

In a compilers sense…

  • We use regex to segment identifiers and numbers separated by whitespace

Regex Combines Characters with

  • Concatenation : One thing after another
  • Repetition : *, something repeated
  • Alternation : One thing or another (OR)
  • Parentheses (): Used like in math
  • Empty String (): Nothing
  • Constant (): One thing