| 
7 | 7 | <link rel="stylesheet" href="checker.css">  | 
8 | 8 | <script src="js-yaml.min.js"></script>  | 
9 | 9 | <script src="checker.js"></script>  | 
 | 10 | +<script src="input2.js"></script>  | 
10 | 11 | <link rel="license" href="https://creativecommons.org/licenses/by/4.0/">  | 
11 | 12 | 
 
  | 
12 | 13 | <!-- Sample expected answer -->  | 
 | 
33 | 34 |     \) , \s*  | 
34 | 35 | </script>  | 
35 | 36 | 
 
  | 
36 |  | -<!--  | 
37 |  | -The following define hints. Hints are expressed in a JSON array, so:  | 
38 |  | -  - \ in a regex is written as \\  | 
39 |  | -  - " in a regex is written as \"  | 
40 |  | -  - All field names and value strings must be quoted  | 
41 |  | -  - commas must *separate* the entries - last one must NOT have a comma.  | 
42 |  | --->  | 
43 |  | -<script id="info" type="application/yaml">  | 
44 |  | ----  | 
45 |  | -hints:  | 
46 |  | -- absent: ", $"  | 
47 |  | -  text: This is a parameter, it must end with a comma.  | 
48 |  | -- absent: |  | 
49 |  | -    query \( ["'`]id["'`] \)  | 
50 |  | -  text: "Use query() with an 'id' parameter."  | 
51 |  | -- present: |  | 
52 |  | -    query \( ["'`]id["'`] \) [^. ]  | 
53 |  | -  text: 'After query("id") use a period to invoke a verification method.'  | 
54 |  | -- present: |  | 
55 |  | -    (islength|Islength|IsLength|ISLENGTH)  | 
56 |  | -  text: >  | 
57 |  | -    JavaScript is case-sensitive. Use isLength instead of the case you have.  | 
58 |  | -- absent: isLength  | 
59 |  | -  text: "Use isLength()."  | 
60 |  | -- present: |  | 
61 |  | -    isLength \( m  | 
62 |  | -  text: "You need to pass isLength() an object within {...}."  | 
63 |  | -- absent: matches  | 
64 |  | -  text: "Use matches()."  | 
65 |  | -- present: |  | 
66 |  | -    matches \( /[^^]  | 
67 |  | -  text: "Match the whole string - begin the regular expression with ^"  | 
68 |  | -- present: |  | 
69 |  | -    matches \( /.*[^$]/  | 
70 |  | -  text: "Match the whole string - end the regular expression with $"  | 
71 |  | -- present: |  | 
72 |  | -    matches \( /.*[^$]/  | 
73 |  | -  text: Match the whole string - end the regular expression with $  | 
74 |  | -- present: |  | 
75 |  | -    matches \( /\^\[A-Z\]-  | 
76 |  | -  text: That would match only one letter before the dash, you need two.  | 
77 |  | -- present: |  | 
78 |  | -    matches \( /.*(\[0-9\]|\d)\*  | 
79 |  | -  text: >  | 
80 |  | -    You need to match one or more digits; * allows 0 or more.  | 
81 |  | -    A + would be better suited for this task.  | 
82 |  | -- present: |  | 
83 |  | -    \s*, , $  | 
84 |  | -  text: >  | 
85 |  | -    You have two commas at the end. Use only one. You may need to  | 
86 |  | -    scroll or increase the text area to see both of them.  | 
87 |  | -successes:  | 
88 |  | -- - query(`id`).isLength( {max:80}).matches(/^[A-Z]{2}-\d+-[0-9]+$/),  | 
89 |  | -- - '  query (`id`) . isLength( {max:80}).matches(/^[A-Z]{2}-\d+-[0-9]+$/ ) ,  '  | 
90 |  | -failures:  | 
91 |  | -- - query('id').isLength({max:80}).matches( /^[A-Z]{2}-[0-9]+- [0-9]+$/ ),  | 
92 |  | -- - query('id').isLength().matches( /^[A-Z]{2}-[0-9]+-[0-9]+$/ ),  | 
93 |  | -- - query('id').isLength({max:80}).matches( /[A-Z]{2}-[0-9]+-[0-9]+/ ),  | 
94 |  | -- - query(`id`).isLength( {max:80}).matches(/^[A-Z]{2}-\d+-[0-9]+$/)  | 
95 |  | -</script>  | 
96 | 37 | </head>  | 
97 | 38 | <body>  | 
98 | 39 | <!-- For GitHub Pages formatting: -->  | 
 | 
0 commit comments