Skip to content

Commit

Permalink
Fix regex1 (#582)
Browse files Browse the repository at this point in the history
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 <dwheeler@dwheeler.com>
  • Loading branch information
david-a-wheeler authored Aug 15, 2024
1 parent d67d5a3 commit 49d8feb
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions docs/labs/regex1.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@
want the text inside the slashes (the pattern itself).
examples:
- - "/"
- present: |-
["'`]
text: In this exercise we only want the regular expression pattern itself.
There is no need to use any kind of quote mark.
examples:
- - "'"
- absent: |-
^\^
text: For input validation, start with '^' to indicate a full match.
Expand Down Expand Up @@ -308,7 +314,8 @@ <h2>Task Information</h2>
symbol.
Unfortunately, different platforms use different regex
symbols for performing a complete match to an input.
The following table shows what you should prepend and append for
The following table shows a summarized version of
what you should prepend and append for
many different platforms (for their default regex system).

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

<p>
More information is available in the OpenSSF guide
<a href="https://best.openssf.org/Correctly-Using-Regular-Expressions"
>Correctly Using Regular Expressions for Secure Input Validation</a>.

<p>
<h2>Interactive Lab (<span id="grade"></span>)</h2>

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

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

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

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

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

<h3>Part 5</h2>
<h3>Part 5</h3>
<p>
Create a regular expression
that only matches one Latin letter (A through Z), followed by a
Expand Down

0 comments on commit 49d8feb

Please sign in to comment.