Skip to content

Commit 49d8feb

Browse files
Fix regex1 (#582)
Various minor fixes: * Fix heading ends to match their beginnings * Add link to OpenSSF guide "Correctly Using Regular Expressions for Secure Input Validation" <https://best.openssf.org/Correctly-Using-Regular-Expressions> * Add hint if user incorrectly adds unnecessary quote marks. Signed-off-by: David A. Wheeler <[email protected]>
1 parent d67d5a3 commit 49d8feb

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

docs/labs/regex1.html

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@
9595
want the text inside the slashes (the pattern itself).
9696
examples:
9797
- - "/"
98+
- present: |-
99+
["'`]
100+
text: In this exercise we only want the regular expression pattern itself.
101+
There is no need to use any kind of quote mark.
102+
examples:
103+
- - "'"
98104
- absent: |-
99105
^\^
100106
text: For input validation, start with '^' to indicate a full match.
@@ -308,7 +314,8 @@ <h2>Task Information</h2>
308314
symbol.
309315
Unfortunately, different platforms use different regex
310316
symbols for performing a complete match to an input.
311-
The following table shows what you should prepend and append for
317+
The following table shows a summarized version of
318+
what you should prepend and append for
312319
many different platforms (for their default regex system).
313320

314321
<p>
@@ -347,13 +354,18 @@ <h2>Task Information</h2>
347354
<tt>^(ab|de)\Z</tt>” or “<tt>\A(ab|de)\Z</tt>” (note that it's
348355
not quite the same thing).
349356

357+
<p>
358+
More information is available in the OpenSSF guide
359+
<a href="https://best.openssf.org/Correctly-Using-Regular-Expressions"
360+
>Correctly Using Regular Expressions for Secure Input Validation</a>.
361+
350362
<p>
351363
<h2>Interactive Lab (<span id="grade"></span>)</h2>
352364

353365
<b>Please create regular expression (regex) patterns
354366
that meet the criteria below.</b>
355367

356-
<h3>Part 1</h2>
368+
<h3>Part 1</h3>
357369
<p>
358370
Create a regular expression, for use in ECMAScript (JavaScript),
359371
that only matches the letters "Y" or "N".
@@ -370,7 +382,7 @@ <h3>Part 1</h2>
370382
<button type="button" class="giveUpButton">Give up</button>
371383
</form>
372384

373-
<h3>Part 2</h2>
385+
<h3>Part 2</h3>
374386
<p>
375387
Create a regular expression, for use in ECMAScript (JavaScript),
376388
that only matches one or more uppercase Latin letters (A through Z).
@@ -388,7 +400,7 @@ <h3>Part 2</h2>
388400
<button type="button" class="giveUpButton">Give up</button>
389401
</form>
390402

391-
<h3>Part 3</h2>
403+
<h3>Part 3</h3>
392404
<p>
393405
Create a regular expression, for use in ECMAScript (JavaScript),
394406
that only matches the words "true" or "false".
@@ -406,7 +418,7 @@ <h3>Part 3</h2>
406418
<button type="button" class="giveUpButton">Give up</button>
407419
</form>
408420

409-
<h3>Part 4</h2>
421+
<h3>Part 4</h3>
410422
<p>
411423
Create a regular expression
412424
that only matches one or more uppercase Latin letters (A through Z).
@@ -425,7 +437,7 @@ <h3>Part 4</h2>
425437
<button type="button" class="giveUpButton">Give up</button>
426438
</form>
427439

428-
<h3>Part 5</h2>
440+
<h3>Part 5</h3>
429441
<p>
430442
Create a regular expression
431443
that only matches one Latin letter (A through Z), followed by a

0 commit comments

Comments
 (0)