Source: https://mokxi.com/learn/path/text-processing-regex
Updated: 2026-11-20

All paths

# Text and regular expressions

Strings, split and join, then regular expressions from search to named groups, on a rocket launch log and a ship's GPS feed, ending in a log analyzer on a Raspberry Pi.

Raspberry Pi 4 Model B Free 7 lessons 5 h 4 chapters 2,373 XP Coding · Intermediate +150 XP

0 of 7 done

Start the course free Strings deep Lesson plan for teachers

What you will build

## 3 projects, built step by step

7 lessons in 4 chapters, about 5 hours on a simulated Raspberry Pi 4 Model B. Free, in your browser, every step checked by the simulator.

Chapter 1 project

### Split and join

split() on a separator, on whitespace and with a limit, unpacking fields into names, reading a whole log file line by line, join() to glue text back together, and partition() for key=value telemetry.
Open it in the simulator

Chapter 2 project

### Groups

Brackets that capture: group() and groups(), turning a T-minus stamp into seconds, named groups and groupdict, findall with groups and non-capturing groups, back-references in re.sub, and finditer with positions.
Open it in the simulator

Chapter 3 project

### Parsing NMEA lines

A ship's GPS feed in NMEA 0183: the XOR checksum that catches corrupted sentences, GGA fields by position, degrees and minutes to decimal degrees, a regex that validates and sorts sentence types, and speed and course from RMC.
Open it in the simulator

The map

## Chapter by chapter

Each lesson opens when the one before it is done, and each chapter ends in a project.

Chapter 1

## Text, cut and glued

What a string really holds, and how to cut a line into fields.

Open 236 XP

### Strings deep

One line of a rocket launch log, taken apart: repr and strip, indexing and slicing, find, in and count, why strings never change, format specs for tidy tables, and escape characters and raw strings.

0 of 6 steps

Start What is in it

Project Locked 472 XP

### Split and join

split() on a separator, on whitespace and with a limit, unpacking fields into names, reading a whole log file line by line, join() to glue text back together, and partition() for key=value telemetry.

0 of 6 steps

5 questions, graded as you go.

Chapter 2

## Regular expressions

Describe text instead of spelling it out, and pull out the pieces.

Locked 236 XP

### re basics

Regular expressions with re: search and the Match object, character classes and repeats, anchors and MULTILINE, counted repeats and word boundaries, re.split and re.sub, and compiled patterns with flags.

0 of 6 steps

Project Locked 472 XP

### Groups

Brackets that capture: group() and groups(), turning a T-minus stamp into seconds, named groups and groupdict, findall with groups and non-capturing groups, back-references in re.sub, and finditer with positions.

0 of 6 steps

5 questions, graded as you go.

Chapter 3

## Parsing real feeds

A launch log and a ship's GPS, turned from text into data.

Locked 236 XP

### Parsing logs

A parser for the whole launch log: one regex per line into (time, system, message) records, telling comments from garbage, counting by system, formatting stamps back, timing events by pattern, and pulling a time window.

0 of 6 steps

Project Locked 472 XP

### Parsing NMEA lines

A ship's GPS feed in NMEA 0183: the XOR checksum that catches corrupted sentences, GGA fields by position, degrees and minutes to decimal degrees, a regex that validates and sorts sentence types, and speed and course from RMC.

0 of 6 steps

5 questions, graded as you go.

Chapter 4

## Project

A log analyzer that answers commands and lights an alarm.

Locked 249 XP

### Project: a log analyzer

Everything in one tool: load and parse the launch log, then answer typed commands (grep with any regex, a time window, ranked stats), survive a broken pattern, and light a red alarm LED when the log holds warnings.

0 of 7 steps

4 questions, graded as you go.

Syllabus

## Every lesson in the course

All 7 lessons, in order, each with what it covers. Any of them opens in the editor right away.

Chapter 1

### Text, cut and glued

- Strings deep One line of a rocket launch log, taken apart: repr and strip, indexing and slicing, find, in and count, why strings never change, format specs for tidy tables, and escape characters and raw strings.
- Split and join split() on a separator, on whitespace and with a limit, unpacking fields into names, reading a whole log file line by line, join() to glue text back together, and partition() for key=value telemetry.

Chapter 2

### Regular expressions

- re basics Regular expressions with re: search and the Match object, character classes and repeats, anchors and MULTILINE, counted repeats and word boundaries, re.split and re.sub, and compiled patterns with flags.
- Groups Brackets that capture: group() and groups(), turning a T-minus stamp into seconds, named groups and groupdict, findall with groups and non-capturing groups, back-references in re.sub, and finditer with positions.

Chapter 3

### Parsing real feeds

- Parsing logs A parser for the whole launch log: one regex per line into (time, system, message) records, telling comments from garbage, counting by system, formatting stamps back, timing events by pattern, and pulling a time window.
- Parsing NMEA lines A ship's GPS feed in NMEA 0183: the XOR checksum that catches corrupted sentences, GGA fields by position, degrees and minutes to decimal degrees, a regex that validates and sorts sentence types, and speed and course from RMC.

Chapter 4

### Project

- Project: a log analyzer Everything in one tool: load and parse the launch log, then answer typed commands (grep with any regex, a time window, ranked stats), survive a broken pattern, and light a red alarm LED when the log holds warnings.

Kits

## Build it on your bench too

Every lesson runs in the simulator with nothing to buy. When you want the real thing, these kits have the parts.

Have a kit already?

### Find your kit

Pick the starter kit you own and run every lesson in its manual with the same parts on the same pins.
See every kit

Questions

## About Text and regular expressions

Is Text and regular expressions free?

Yes. All 7 lessons of Text and regular expressions are free and run in your browser, with nothing to install and no parts to buy before you start.

Do I need a real Raspberry Pi 4 Model B?

No. Every lesson runs on a simulated Raspberry Pi 4 Model B with its parts on the canvas, and the simulator checks each step as you go. When you want to build it for real, the same wiring and code work on a real board.

How long does Text and regular expressions take?

About 5 hours: 7 lessons in 4 chapters, each one a few short steps. Your progress is kept, so you can stop after any lesson and pick up where you left off.

What will I build?

Each chapter ends in a project that puts it together: Split and join, Groups and Parsing NMEA lines.

Where do I start?

With "Strings deep", and each lesson builds on the one before it. New to circuits? Electronics basics is the course that starts from zero.
