Skip to content

Commit bbd7421

Browse files
regex1.html: Minor wordsmithing and formatting
Signed-off-by: David A. Wheeler <[email protected]>
1 parent 96ea79c commit bbd7421

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

docs/labs/regex1.html

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,13 @@ <h2>Task Information</h2>
297297
<p>
298298
We want to use regexes to <i>validate</i> input.
299299
That is, the input should <i>completely</i> match the regex pattern.
300-
In regexes you can do this by prepending some symbol and appending a different
300+
In regexes you can do this by using its default mode
301+
(not a "multiline" mode), prepending some symbol, and appending a different
301302
symbol.
302-
Unfortunately, different languages use different symbols.
303-
The following table shows what you should prepend and append.
303+
Unfortunately, different platforms use different regex
304+
symbols for performing a complete match to an input.
305+
The following table shows what you should prepend and append for
306+
many different platforms (for their default regex system).
304307

305308
<p>
306309
<table>
@@ -331,7 +334,12 @@ <h2>Task Information</h2>
331334
</table>
332335

333336
<p>
334-
For example, to validate in JavaScript that the input is only “ab” or “de”, use the regex “^(ab|de)$”. To validate the same thing in Python, use “^(ab|de)\Z” or “\A(ab|de)\Z”.
337+
For example, to validate in ECMAScript (JavaScript)
338+
that an input is must be either “<tt>ab</tt>” or “<tt>de</tt>”,
339+
use the regex “<tt>^(ab|de)$</tt>”.
340+
To validate the same thing in Python, use
341+
<tt>^(ab|de)\Z</tt>” or “<tt>\A(ab|de)\Z</tt>” (note that it's
342+
not quite the same thing).
335343

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

0 commit comments

Comments
 (0)