From 26d1bb55b50d9030922fcd9bbc88d14073700d82 Mon Sep 17 00:00:00 2001 From: Eric Willigers Date: Sun, 21 Jun 2026 20:41:08 +1000 Subject: [PATCH] ledger-lookout: clearer example --- config.json | 2 +- .../ledger-lookout/.docs/introduction.md | 25 +++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/config.json b/config.json index d861cef..a485267 100644 --- a/config.json +++ b/config.json @@ -295,7 +295,7 @@ "regexp", "sequences" ], - "status": "wip" + "status": "beta" }, { "slug": "lap-leaderboard", diff --git a/exercises/concept/ledger-lookout/.docs/introduction.md b/exercises/concept/ledger-lookout/.docs/introduction.md index 1458d04..0fc3de9 100644 --- a/exercises/concept/ledger-lookout/.docs/introduction.md +++ b/exercises/concept/ledger-lookout/.docs/introduction.md @@ -63,23 +63,28 @@ spot **without** making those characters part of the match. It is "zero-width": what it tests is not included in the result. ``` -(?=...) ! lookahead: ... must follow -(?!...) ! negative lookahead: ... must NOT follow -(?<=...) ! lookbehind: ... must come before +(?=...) ! lookahead: ... must follow +(?!...) ! negative lookahead: ... must NOT follow +(?<=...) ! lookbehind: ... must come before +(? { "100" "25" } (digits that follow a $; the $ is left out) +"3 for $10 or 10 for $30" R/ \d+/ all-matching-subseqs . +! => { "3" "10" "10" "30" } (every number) -"up 5% then 12%" R/ \d+(?=%)/ all-matching-subseqs . -! => { "5" "12" } (digits that come right before a %) -``` +"3 for $10 or 10 for $30" R/ (?<=\$)\d+/ all-matching-subseqs . +! => { "10" "30" } (only the prices — the bare 3 and 10 drop) -Lookaround is how you say "the part I want, recognised by what -surrounds it" — exactly what capture groups do elsewhere. +"buy 2 at 15% off, 4 at 30% off" R/ \d+(?=%)/ all-matching-subseqs . +! => { "15" "30" } (only the discounts — the bare 2 and 4 drop) +``` ## Options