|
1 | 1 | info = |
2 | 2 | { |
| 3 | + // Note: Regular expressions are preprocessed specially in this lab. |
| 4 | + // We simply remove whitespace in them. |
3 | 5 | hints: [ |
4 | 6 | { |
5 | 7 | present: "^$", |
6 | | - text: "You need to enter a pattern." |
| 8 | + text: "You need to enter a pattern.", |
| 9 | + examples: [ |
| 10 | + [ "" ] |
| 11 | + ], |
7 | 12 | }, |
8 | 13 | { |
9 | 14 | present: String.raw`^\^`, |
10 | | - text: "We are looking for 'cat' anywhere, not just the beginning, in this exercise." |
| 15 | + text: "We are looking for 'cat' anywhere, not just the beginning, in this exercise.", |
| 16 | + examples: [ |
| 17 | + [ "^cat" ], |
| 18 | + ], |
11 | 19 | }, |
12 | 20 | { |
13 | 21 | present: "C", |
14 | 22 | text: "Regexes are normally case-sensitive. Use a lowercase c.", |
15 | 23 | examples: [ |
16 | | - [ "C" ] |
| 24 | + [ "C" ], |
17 | 25 | ], |
18 | 26 | }, |
19 | 27 | { |
20 | 28 | absent: "c", |
21 | 29 | text: "If you are searching for \"cat\" you need to look for a \"c\"", |
22 | 30 | examples: [ |
23 | | - [ "x" ] |
| 31 | + [ "x" ], |
24 | 32 | ], |
25 | 33 | }, |
26 | 34 | { |
27 | 35 | absent: "cat", |
28 | | - text: "The pattern \"cat\" is needed to search for \"cat\"." |
| 36 | + text: "The pattern \"cat\" is needed to search for \"cat\".", |
| 37 | + examples: [ |
| 38 | + [ "c" ], |
| 39 | + ], |
29 | 40 | }, |
30 | 41 | { |
31 | 42 | absent: "A", |
32 | 43 | index: 1, |
33 | | - text: "You need to mention A." |
| 44 | + text: "You need to mention A.", |
| 45 | + examples: [ |
| 46 | + [ "cat", "B" ], |
| 47 | + ], |
34 | 48 | }, |
35 | 49 | { |
36 | | - absent: "B", |
| 50 | + absent: String.raw`A(\+|A\*)`, |
37 | 51 | index: 1, |
38 | | - text: "You need to mention B." |
| 52 | + text: "Use \"A+\" to indicate \"one or more A\". You could also write \"AA*\".", |
| 53 | + examples: [ |
| 54 | + [ "cat", "A" ], |
| 55 | + [ "cat", "AA" ], |
| 56 | + ], |
39 | 57 | }, |
40 | 58 | { |
41 | | - absent: String.raw`A(\+|A\*)`, |
| 59 | + absent: "B", |
42 | 60 | index: 1, |
43 | | - text: "Use \"A+\" to indicate \"one or more A\". You could also write \"AA*\"." |
| 61 | + text: "You need to mention B.", |
| 62 | + examples: [ |
| 63 | + [ "cat", "A+" ], |
| 64 | + ], |
44 | 65 | }, |
45 | 66 | { |
46 | 67 | absent: String.raw`B(\+|B\*)`, |
| 68 | + present: 'A', |
47 | 69 | index: 1, |
48 | | - text: "Use \"B+\" to indicate \"one or more B\". You could also write \"BB*\"." |
| 70 | + text: "Use \"B+\" to indicate \"one or more B\". You could also write \"BB*\".", |
| 71 | + examples: [ |
| 72 | + [ "cat", "A+B" ], |
| 73 | + ], |
49 | 74 | }, |
50 | 75 | ], |
51 | 76 | expected: [ |
|
68 | 93 | preprocessing: [ |
69 | 94 | [ |
70 | 95 | "\\s*", |
71 | | - "" |
| 96 | + "", |
72 | 97 | ], |
73 | 98 | ], |
74 | 99 | }; |
0 commit comments