Softanza
StartFrançais
Softanza
The book · Chapter 8 · The proof of each chapter

Patterns in text

This chapter has 4 cells and writes 9 promises. In each of its four editions its cells were run in one fresh process on 2026-10-08 20:15: English, 4 cells ran, 9 promises kept; Français, 4 cells ran, 9 promises kept; العربية, 4 cells ran, 9 promises kept; Hausa, 4 cells ran, 9 promises kept. The four editions make the same promises, cell for cell. No edition stores any output.

The guard

The course's guard is course_narrated.ring(opens in a new tab): it runs every chapter in all four languages, compares the promises from one edition to the next, and has every exercise prove itself on its wrong and right answers. This page asked the same questions of the same objects, in one process inside the library, at commit 0e72e2e2c. To prove this chapter alone, from your copy of the repository:

cd libraries/stzlib/base/test/education
# run course_narrated with the repository's runtime, for this chapter:
#   course_narrated patterns-in-text

run on 2026-10-08 20:15 inside the library at commit 4a184e6f0, in 246.4 s for the whole book · The four editions of the chapter: English(opens in a new tab) · Français(opens in a new tab) · العربية(opens in a new tab) · Hausa(opens in a new tab)

The reader stores no output, by the course's own law; this page is the record of a run, made for it.

The cells, run

Cell 1 · 1. A date has a shape

Softanza
? rx("[0-9]{4}-[0-9]{2}-[0-9]{2}").Match("2026-09-24")
#--> TRUE
? rx("[0-9]{4}-[0-9]{2}-[0-9]{2}").Match("24/09/2026")
#--> FALSE
Output of this run
1
0

ran: the promise is kept · in all four editions

This cell in the chapter: English(opens in a new tab) · Français(opens in a new tab) · العربية(opens in a new tab) · Hausa(opens in a new tab)

Cell 2 · 2. Somewhere in the text, or the whole text

Softanza
? rx("[0-9]+").Match("24/09/2026")
#--> FALSE
? rx("[0-9]+").MatchFirst("24/09/2026")
#--> TRUE
? @@( Q("tea 12, rice 30").Numbers() )
#--> [ "12", "30" ]
Output of this run
0
1
[ "12", "30" ]

ran: the promise is kept · in all four editions

This cell in the chapter: English(opens in a new tab) · Français(opens in a new tab) · العربية(opens in a new tab) · Hausa(opens in a new tab)

Cell 3 · 3. A phone number in Niger

Softanza
cPhone = "^\+227 [0-9]{2} [0-9]{2} [0-9]{2} [0-9]{2}$"
? rx(cPhone).Match("+227 90 12 34 56")
#--> TRUE
? rx(cPhone).Match("90 12 34 56")
#--> FALSE
Output of this run
1
0

ran: the promise is kept · in all four editions

This cell in the chapter: English(opens in a new tab) · Français(opens in a new tab) · العربية(opens in a new tab) · Hausa(opens in a new tab)

Cell 4 · 4. A word said twice

Softanza
cTwice = "\b(?P<word>\w+)[\s]*(?P=word)\b"
? rx(cTwice).Match("the the")
#--> TRUE
? rx(cTwice).Match("the that")
#--> FALSE
Output of this run
1
0

ran: the promise is kept · in all four editions

This cell in the chapter: English(opens in a new tab) · Français(opens in a new tab) · العربية(opens in a new tab) · Hausa(opens in a new tab)

The exercises

Every exercise proves itself: its wrong answers are refused and its right answers accepted.

ex-08-01 · Exercise 8.1 · The shape of a date

2 of 2 wrong answers refused, 2 of 2 right answers accepted

01-too-loose.ring refused · 02-only-one-date.ring refused · 01-digits-and-dashes.ring accepted · 02-the-short-form.ring accepted

The exercise's folder(opens in a new tab)