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 BFree7 lessons5 h4 chapters2,373 XPCoding · Intermediate+150 XP

0 of 7 done

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.

  1. Open236 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

  2. ProjectLocked472 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.

  1. Locked236 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

  2. ProjectLocked472 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.

  1. Locked236 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

  2. ProjectLocked472 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.

  1. Locked249 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

  1. Strings deepOne 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.
  2. Split and joinsplit() 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

  1. re basicsRegular 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.
  2. GroupsBrackets 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

  1. Parsing logsA 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.
  2. Parsing NMEA linesA 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

  1. Project: a log analyzerEverything 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.