© Zsolt Nagy 2018
Zsolt NagyRegex Quick Syntax Referencehttps://doi.org/10.1007/978-1-4842-3876-9_5

5. Repeat Modifiers

Zsolt Nagy1 
(1)
Berlin, Germany
 
In Chapter 1, I explained that regular expressions are imperative. Imperative languages come with control structures. When developing software using a programming language, we use the following control structures:
  • Branching: In most programming languages, we use if statements and switches. In regular expressions, we branch off using the | metasyntax character or using character sets. An | structure vaguely corresponds to an if-else structure, and a character set vaguely corresponds to a switch statement. An example of character sets is [ab]. Read it like a|b. In other words, choose either a or b.

Get Regex Quick Syntax Reference: Understanding and Using Regular Expressions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.