Regular Expression

  • Recognize: match the WHOLE string, e.g. [a-z]
    • String: "dgh" -> Match: "dgh"
    • String: "sh3sa" -> Match: Nope
  • Search: match sth INSIDE the string, e.g. [a-z]
    • String: "dgh" -> Match: "dgh"
    • String: "sh3sa" -> Match: "sh", "sa"
    • 1st possible v.s. longest 1st/overall match

Regular Expression

  • Greedy: take as much as possible! Longest 1st/overall match (every lang picks what it means)
  • Capture: name part of the string, e.g. [a-z]
    • String: "sh3sa" -> capture[0]: "sh", capture[1]: "sa"
  • Replace: replace a match with something else, e.g. [a-z] -> W5
    • String: "sh3sa" -> Result: "W53W5"