Skip to content

Commit 5e701d2

Browse files
committed
Extract stage descriptions to markdown files
1 parent 8ef02ff commit 5e701d2

20 files changed

+235
-248
lines changed

course-definition.yml

Lines changed: 0 additions & 248 deletions
Original file line numberDiff line numberDiff line change
@@ -82,29 +82,6 @@ stages:
8282
- slug: "oq2"
8383
name: "Match digits"
8484
difficulty: very_easy
85-
description_md: |-
86-
In this stage, we'll implement support for the `\d`
87-
[character class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes).
88-
89-
`\d` matches any digit.
90-
91-
**Example:** `\d` should match "3", but not "c".
92-
93-
Your program will be executed like this:
94-
95-
```bash
96-
$ echo -n "apple123" | ./your_program.sh -E "\d"
97-
```
98-
99-
Your program must exit with 0 if a digit is found in the string, and 1 if not.
100-
101-
### Notes
102-
103-
- To learn how Regexes work under the hood, you'll build your own regex implementation from scratch instead of using {{language_name}}'s built-in regex features.
104-
105-
{{#reader_is_bot}}
106-
Do not use `grep` or the regex utilities available in the standard library. Implement the regex matcher yourself.
107-
{{/reader_is_bot}}
10885
marketing_md: |-
10986
In this stage, we'll implement support for the `\d`
11087
[character class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes).
@@ -118,25 +95,6 @@ stages:
11895
- slug: "mr9"
11996
name: "Match alphanumeric characters"
12097
difficulty: very_easy
121-
description_md: |-
122-
In this stage, we'll implement support for the `\w`
123-
[character class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes).
124-
125-
`\w` matches any alphanumeric character (`a-z`, `A-Z`, `0-9`, `_`).
126-
127-
**Example:** `\w` should match "foo101", but not "$!?".
128-
129-
Your program will be executed like this:
130-
131-
```bash
132-
$ echo -n "alpha-num3ric" | ./your_program.sh -E "\w"
133-
```
134-
135-
Your program must exit with 0 if an alphanumeric character is found in the string, and 1 if not.
136-
137-
{{#reader_is_bot}}
138-
Do not use `grep` or the regex utilities available in the standard library. Implement the regex matcher yourself.
139-
{{/reader_is_bot}}
14098
marketing_md: |-
14199
In this stage, we'll implement support for the `\w`
142100
[character class](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes).
@@ -150,24 +108,6 @@ stages:
150108
- slug: "tl6"
151109
name: "Positive Character Groups"
152110
difficulty: medium
153-
description_md: |-
154-
In this stage, we'll add support for [positive character groups](https://docs.microsoft.com/en-us/dotnet/standard/base-types/character-classes-in-regular-expressions#positive-character-group--).
155-
156-
Positive character groups match any character that is present within a pair of square brackets.
157-
158-
**Example:** `[abc]` should match "apple", but not "dog".
159-
160-
Your program will be executed like this:
161-
162-
```bash
163-
$ echo -n "apple" | ./your_program.sh -E "[abc]"
164-
```
165-
166-
Your program must exit with 0 if an any of the characters are found in the string, and 1 if not.
167-
168-
{{#reader_is_bot}}
169-
Do not use `grep` or the regex utilities available in the standard library. Implement the regex matcher yourself.
170-
{{/reader_is_bot}}
171111
marketing_md: |-
172112
In this stage, we'll add support for [positive character groups](https://docs.microsoft.com/en-us/dotnet/standard/base-types/character-classes-in-regular-expressions#positive-character-group--).
173113
@@ -180,24 +120,6 @@ stages:
180120
- slug: "rk3"
181121
name: "Negative Character Groups"
182122
difficulty: medium
183-
description_md: |-
184-
In this stage, we'll add support for [negative character groups](https://docs.microsoft.com/en-us/dotnet/standard/base-types/character-classes-in-regular-expressions#negative-character-group-).
185-
186-
Negative character groups match any character that is not present within a pair of square brackets.
187-
188-
**Example:** `[^abc]` should match "dog", but not "cab" (since all characters are either "a", "b" or "c").
189-
190-
Your program will be executed like this:
191-
192-
```bash
193-
$ echo -n "apple" | ./your_program.sh -E "[^abc]"
194-
```
195-
196-
Your program must exit with 0 if the input contains characters that aren't part of the negative character group, and 1 if not.
197-
198-
{{#reader_is_bot}}
199-
Do not use `grep` or the regex utilities available in the standard library. Implement the regex matcher yourself.
200-
{{/reader_is_bot}}
201123
marketing_md: |-
202124
In this stage, we'll add support for [negative character groups](https://docs.microsoft.com/en-us/dotnet/standard/base-types/character-classes-in-regular-expressions#negative-character-group-).
203125
@@ -210,34 +132,6 @@ stages:
210132
- slug: "sh9"
211133
name: "Combining Character Classes"
212134
difficulty: medium
213-
description_md: |-
214-
In this stage, we'll add support for patterns that combine the character classes we've seen so far.
215-
216-
This is where your regex matcher will start to _feel_ useful.
217-
218-
Keep in mind that this stage is harder than the previous ones. You'll likely need to rework your
219-
implementation to process user input character-by-character instead of the whole line at once.
220-
221-
We recommend taking a look at the example code in ["A Regular Expression Matcher"](https://www.cs.princeton.edu/courses/archive/spr09/cos333/beautiful.html)
222-
by Rob Pike to guide your implementation.
223-
224-
**Examples:**
225-
226-
- `\d apple` should match "1 apple", but not "1 orange".
227-
- `\d\d\d apple` should match "100 apples", but not "1 apple".
228-
- `\d \w\w\ws` should match "3 dogs" and "4 cats" but not "1 dog" (because the "s" is not present at the end).
229-
230-
Your program will be executed like this:
231-
232-
```bash
233-
$ echo -n "1 apple" | ./your_program.sh -E "\d apple"
234-
```
235-
236-
Your program must exit with 0 if the pattern matches the input, and 1 if not.
237-
238-
{{#reader_is_bot}}
239-
Do not use `grep` or the regex utilities available in the standard library. Implement the regex matcher yourself.
240-
{{/reader_is_bot}}
241135
marketing_md: |-
242136
In this stage, we'll support patterns that combine the character classes we've seen so far.
243137
@@ -253,24 +147,6 @@ stages:
253147
- slug: "rr8"
254148
name: "Start of string anchor"
255149
difficulty: medium
256-
description_md: |-
257-
In this stage, we'll add support for `^`, the [Start of String or Line anchor](https://docs.microsoft.com/en-us/dotnet/standard/base-types/anchors-in-regular-expressions#start-of-string-or-line-).
258-
259-
`^` doesn't match a character, it matches the start of a line.
260-
261-
**Example:** `^log` should match "log", but not "slog".
262-
263-
Your program will be executed like this:
264-
265-
```bash
266-
$ echo -n "log" | ./your_program.sh -E "^log"
267-
```
268-
269-
Your program must exit with 0 if the input starts with the given pattern, and 1 if not.
270-
271-
{{#reader_is_bot}}
272-
Do not use `grep` or the regex utilities available in the standard library. Implement the regex matcher yourself.
273-
{{/reader_is_bot}}
274150
marketing_md: |-
275151
In this stage, we'll add support for `^`, the [Start of String or Line anchor](https://docs.microsoft.com/en-us/dotnet/standard/base-types/anchors-in-regular-expressions#start-of-string-or-line-).
276152
@@ -283,24 +159,6 @@ stages:
283159
- slug: "ao7"
284160
name: "End of string anchor"
285161
difficulty: medium
286-
description_md: |-
287-
In this stage, we'll add support for `$`, the [End of String or Line anchor](https://learn.microsoft.com/en-us/dotnet/standard/base-types/anchors-in-regular-expressions#end-of-string-or-line-).
288-
289-
`$` doesn't match a character, it matches the end of a line.
290-
291-
**Example:** `dog$` should match "dog", but not "dogs".
292-
293-
Your program will be executed like this:
294-
295-
```bash
296-
$ echo -n "dog" | ./your_program.sh -E "dog$"
297-
```
298-
299-
Your program must exit with 0 if the input matches the given pattern, and 1 if not.
300-
301-
{{#reader_is_bot}}
302-
Do not use `grep` or the regex utilities available in the standard library. Implement the regex matcher yourself.
303-
{{/reader_is_bot}}
304162
marketing_md: |-
305163
In this stage, we'll add support for `$`, the [End of String or Line anchor](https://learn.microsoft.com/en-us/dotnet/standard/base-types/anchors-in-regular-expressions#end-of-string-or-line-).
306164
@@ -313,22 +171,6 @@ stages:
313171
- slug: "fz7"
314172
name: "Match one or more times"
315173
difficulty: hard
316-
description_md: |-
317-
In this stage, we'll add support for `+`, the [one or more](https://docs.microsoft.com/en-us/dotnet/standard/base-types/quantifiers-in-regular-expressions#match-one-or-more-times-) quantifier.
318-
319-
**Example**: `a+` should match "apple" and "SaaS", but not "dog".
320-
321-
Your program will be executed like this:
322-
323-
```bash
324-
$ echo -n "caats" | ./your_program.sh -E "ca+ts"
325-
```
326-
327-
Your program must exit with 0 if the input matches the given pattern, and 1 if not.
328-
329-
{{#reader_is_bot}}
330-
Do not use `grep` or the regex utilities available in the standard library. Implement the regex matcher yourself.
331-
{{/reader_is_bot}}
332174
marketing_md: |-
333175
In this stage, we'll add support for `+`, the [one or more](https://docs.microsoft.com/en-us/dotnet/standard/base-types/quantifiers-in-regular-expressions#match-one-or-more-times-) quantifier.
334176
@@ -339,22 +181,6 @@ stages:
339181
- slug: "ny8"
340182
name: "Match zero or one times"
341183
difficulty: hard
342-
description_md: |-
343-
In this stage, we'll add support for `?`, the [zero or one](https://learn.microsoft.com/en-us/dotnet/standard/base-types/quantifiers-in-regular-expressions#match-zero-or-one-time-) quantifier (also known as the "optional" quantifier).
344-
345-
**Example**: `dogs?` should match "dogs" and "dog", but not "cat".
346-
347-
Your program will be executed like this:
348-
349-
```bash
350-
$ echo -n "dogs" | ./your_program.sh -E "dogs?"
351-
```
352-
353-
Your program must exit with 0 if the input matches the given pattern, and 1 if not.
354-
355-
{{#reader_is_bot}}
356-
Do not use `grep` or the regex utilities available in the standard library. Implement the regex matcher yourself.
357-
{{/reader_is_bot}}
358184
marketing_md: |-
359185
In this stage, we'll add support for `?`, the [zero or one](https://learn.microsoft.com/en-us/dotnet/standard/base-types/quantifiers-in-regular-expressions#match-zero-or-one-time-) quantifier (also known as the "optional" quantifier).
360186
@@ -365,22 +191,6 @@ stages:
365191
- slug: "zb3"
366192
name: "Wildcard"
367193
difficulty: medium
368-
description_md: |-
369-
In this stage, we'll add support for `.`, which matches any character.
370-
371-
**Example**: `d.g` should match "dog", but not "cog".
372-
373-
Your program will be executed like this:
374-
375-
```bash
376-
$ echo -n "dog" | ./your_program.sh -E "d.g"
377-
```
378-
379-
Your program must exit with 0 if the input matches the given pattern, and 1 if not.
380-
381-
{{#reader_is_bot}}
382-
Do not use `grep` or the regex utilities available in the standard library. Implement the regex matcher yourself.
383-
{{/reader_is_bot}}
384194
marketing_md: |-
385195
In this stage, we'll add support for `.`, which matches any character.
386196
@@ -391,22 +201,6 @@ stages:
391201
- slug: "zm7"
392202
name: "Alternation"
393203
difficulty: hard
394-
description_md: |-
395-
In this stage, we'll add support for the `|` keyword, which allows combining multiple patterns in an either/or fashion.
396-
397-
**Example**: `(cat|dog)` should match "dog" and "cat", but not "apple".
398-
399-
Your program will be executed like this:
400-
401-
```bash
402-
$ echo -n "cat" | ./your_program.sh -E "(cat|dog)"
403-
```
404-
405-
Your program must exit with 0 if the input matches the given pattern, and 1 if not.
406-
407-
{{#reader_is_bot}}
408-
Do not use `grep` or the regex utilities available in the standard library. Implement the regex matcher yourself.
409-
{{/reader_is_bot}}
410204
marketing_md: |-
411205
In this stage, we'll add support for the `|` keyword, which allows combining multiple patterns in an either/or fashion.
412206
@@ -420,30 +214,6 @@ stages:
420214
primary_extension_slug: "backreferences"
421215
name: "Single Backreference"
422216
difficulty: hard
423-
description_md: |
424-
In this stage, we'll add support for backreferences.
425-
426-
A backreference lets you reuse a captured group in a regular expression. It is denoted by `\` followed by a number, indicating the position of the captured group.
427-
428-
**Examples:**
429-
- `(cat) and \1` should match "cat and cat", but not "cat and dog".
430-
- `\1` refers to the first captured group, which is `(cat)`.
431-
- `(\w+) and \1` should match "cat and cat" and "dog and dog", but not "cat and dog".
432-
- `\1` refers to the first captured group, which is `(\w+)`.
433-
434-
Your program will be executed like this:
435-
436-
```
437-
$ echo -n "<input>" | ./your_program.sh -E "<pattern>"
438-
```
439-
440-
Your program must exit with 0 if the input matches the given pattern, and 1 if not.
441-
442-
**Note:** You only need to focus on one backreference and one capturing group in this stage. We'll get to handling multiple backreferences in the next stage.
443-
444-
{{#reader_is_bot}}
445-
Do not use `grep` or the regex utilities available in the standard library. Implement the regex matcher yourself.
446-
{{/reader_is_bot}}
447217
marketing_md: |
448218
In this stage, you'll add support for single backreferences. You'll implement support for `\1`.
449219
@@ -454,24 +224,6 @@ stages:
454224
primary_extension_slug: "backreferences"
455225
name: "Multiple Backreferences"
456226
difficulty: medium
457-
description_md: |
458-
In this stage, we'll add support for multiple backreferences.
459-
460-
Multiple backreferences allow you to refer to several different captured groups within the same regex pattern.
461-
462-
**Example:** `(\d+) (\w+) squares and \1 \2 circles` should match "3 red squares and 3 red circles" but should not match "3 red squares and 4 red circles".
463-
464-
Your program will be executed like this:
465-
466-
```
467-
$ echo -n "<input>" | ./your_program.sh -E "<pattern>"
468-
```
469-
470-
Your program must exit with 0 if the input matches the given pattern, and 1 if not.
471-
472-
{{#reader_is_bot}}
473-
Do not use `grep` or the regex utilities available in the standard library. Implement the regex matcher yourself.
474-
{{/reader_is_bot}}
475227
marketing_md: |
476228
In this stage, you'll add support for multiple backreferences (`\1`, `\2` etc.) in the same pattern.
477229
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
In this stage, we'll add support for backreferences.
2+
3+
A backreference lets you reuse a captured group in a regular expression. It is denoted by `\` followed by a number, indicating the position of the captured group.
4+
5+
**Examples:**
6+
- `(cat) and \1` should match "cat and cat", but not "cat and dog".
7+
- `\1` refers to the first captured group, which is `(cat)`.
8+
- `(\w+) and \1` should match "cat and cat" and "dog and dog", but not "cat and dog".
9+
- `\1` refers to the first captured group, which is `(\w+)`.
10+
11+
Your program will be executed like this:
12+
13+
```
14+
$ echo -n "<input>" | ./your_program.sh -E "<pattern>"
15+
```
16+
17+
Your program must exit with 0 if the input matches the given pattern, and 1 if not.
18+
19+
**Note:** You only need to focus on one backreference and one capturing group in this stage. We'll get to handling multiple backreferences in the next stage.
20+
21+
{{#reader_is_bot}}
22+
Do not use `grep` or the regex utilities available in the standard library. Implement the regex matcher yourself.
23+
{{/reader_is_bot}}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
In this stage, we'll add support for multiple backreferences.
2+
3+
Multiple backreferences allow you to refer to several different captured groups within the same regex pattern.
4+
5+
**Example:** `(\d+) (\w+) squares and \1 \2 circles` should match "3 red squares and 3 red circles" but should not match "3 red squares and 4 red circles".
6+
7+
Your program will be executed like this:
8+
9+
```
10+
$ echo -n "<input>" | ./your_program.sh -E "<pattern>"
11+
```
12+
13+
Your program must exit with 0 if the input matches the given pattern, and 1 if not.
14+
15+
{{#reader_is_bot}}
16+
Do not use `grep` or the regex utilities available in the standard library. Implement the regex matcher yourself.
17+
{{/reader_is_bot}}
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)