1 / 6
Regular Expressions — Pattern Matching & Formal Languages
Learn how regular expressions describe sets of strings, their syntax, and how they relate to finite state machines and formal languages.
📚 Learning Steps
💡 Study Tips
- • Read through at your own pace
- • Try the interactive simulators hands-on
- • Study the pseudocode — it appears in exams
- • Quiz yourself before moving on
Step 1: What is a Regular Expression?
📖 TheoryA regular expression (regex) is a special notation for describing a SET of strings (a language). It uses a small set of operators to define patterns.
Regular expressions are used:
•By compilers to recognise tokens (keywords, numbers, identifiers)
•In search engines and text editors for finding patterns
•In network security for matching packet signatures
•In formal language theory to define regular languages
Every regular expression defines a regular language — and every regular language can be recognised by a finite state machine. This equivalence is fundamental to the theory of computation.
🎯 Key Points
- •A regex defines a SET of strings (a language)
- •Every regex corresponds to a regular language
- •Every regular language can be recognised by an FSM (and vice versa)
- •They are used in compilers, text search, and formal language theory
- •AQA uses formal regex syntax, not programming regex
0/6 steps completed