Skip to content

Commit e2dac68

Browse files
Lab regex1.html: Remove YAML
Signed-off-by: David A. Wheeler <[email protected]>
1 parent 1b31702 commit e2dac68

File tree

2 files changed

+2
-164
lines changed

2 files changed

+2
-164
lines changed

docs/labs/regex1.html

Lines changed: 0 additions & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -86,168 +86,6 @@
8686
\\z
8787
</script>
8888

89-
<script id="info" type="application/yaml">
90-
---
91-
hints:
92-
- present: |-
93-
/
94-
text: In JavaScript a constant regular expression is surrounded by
95-
forward slashes like /PATTERN/. However, for this exercise we only
96-
want the text inside the slashes (the pattern itself).
97-
examples:
98-
- - "/"
99-
- present: |-
100-
["'`]
101-
text: In this exercise we only want the regular expression pattern itself.
102-
There is no need to use any kind of quote mark.
103-
examples:
104-
- - "'"
105-
- absent: |-
106-
^\^
107-
text: For input validation, start with '^' to indicate a full match.
108-
examples:
109-
- - "(Y|N)"
110-
- present: |-
111-
\\[Zz]
112-
text: The ECMAScript (JavaScript) specification does not support \Z or \z.
113-
examples:
114-
- - "^Y|N\\z"
115-
- absent: |-
116-
\$$
117-
text: For input validation, end with '$' to indicate a full match.
118-
examples:
119-
- - "^(Y|N)"
120-
- absent: |-
121-
[\|\[]
122-
text: Consider using [YN], to match either a Y or an N.
123-
examples:
124-
- - "^$"
125-
- present: |-
126-
\|
127-
absent: |-
128-
\(
129-
text: If you use "|" you must parentheses or the precedence will be wrong.
130-
For example, "^A|B$" accepts anything beginning with A, and it also
131-
accepts anything ending with B. That is not what you want.
132-
examples:
133-
- - "^Y|N$"
134-
- present: " "
135-
text: Spaces normally match spaces in a regex. Do not use them in this case,
136-
because a space is not one of the allowed characters.
137-
examples:
138-
- - "^[YN] $"
139-
- absent: |-
140-
^\^
141-
index: 1
142-
text: For input validation, start with '^' to indicate a full match.
143-
examples:
144-
-
145-
- "^[YN]$"
146-
- ""
147-
- absent: |-
148-
\$$
149-
index: 1
150-
text: For input validation, end with '$' to indicate a full match.
151-
examples:
152-
-
153-
- "^[YN]$"
154-
- "^"
155-
- absent: |-
156-
\[A-Z\]
157-
index: 1
158-
text: You can use [A-Z] to match one uppercase Latin letter (A through Z).
159-
examples:
160-
-
161-
- "^[YN]$"
162-
- "^$"
163-
- present: |-
164-
\^\[A-Z\]\*
165-
index: 1
166-
text: A "*" matches one or more, not one or more.
167-
- present: |-
168-
\(
169-
index: 1
170-
text: You do not need parentheses to solve this problem.
171-
- absent: |-
172-
(\[A-Z\]\+|
173-
\[A-Z\]\[A-Z\]\*)
174-
index: 1
175-
text: You can use [A-Z]+ to match one or more uppercase Latin letters.
176-
examples:
177-
-
178-
- "^[YN]$"
179-
- "^[A-Z]$"
180-
- present: "True"
181-
index: 2
182-
text: Regular expressions are case-sensitive by default; use "true".
183-
- present: "False"
184-
index: 2
185-
text: Regular expressions are case-sensitive by default; use "false".
186-
- absent: |-
187-
\|
188-
index: 2
189-
text: Use "|" to express alternatives.
190-
- present: |-
191-
^\^true\|false\$$
192-
index: 2
193-
text: No. This would match anything beginning with the term true,
194-
or anything ending with the term false. Use parenthesis.
195-
- present: |-
196-
^\^false\|true\$$
197-
index: 2
198-
text: No. This would match anything beginning with the term false,
199-
or anything ending with the term true. Use parenthesis.
200-
- absent: |-
201-
\(
202-
index: 2
203-
text: Use parentheses.
204-
- present: |-
205-
\$
206-
index: 3
207-
text: This is Python, not ECMAScript (JavaScript). Use \Z at the end, not $.
208-
- present: |-
209-
\\z
210-
index: 3
211-
text: This is Python. Use \Z at the end, not \z.
212-
- absent: |-
213-
^\\A
214-
index: 4
215-
text: This is Ruby. Use \A at the beginning.
216-
- absent: |-
217-
\\z$
218-
index: 4
219-
text: This is Ruby. Use \z at the beginning.
220-
- absent: |-
221-
\[A-Z\]
222-
index: 4
223-
text: Use [A-Z] to match one uppercase Latin letter.
224-
- present: |-
225-
\[A-Z\](\*|\+)
226-
index: 4
227-
text: In this case we are only matching one letter, not many of them.
228-
Do not use "*" or "+" after [A-Z].
229-
# successes:
230-
# - - " query ( 'id' ) . isInt ( {min: 1 , max: 9999 } ) ,"
231-
# - - " query ( `id` ) . isInt ( {min: 1 , max: 9_999 } ) , "
232-
# - - 'query ( "id" ) . isInt ( {min: 1 , max: 9_999 } ) ,'
233-
# failures:
234-
# - - " query,"
235-
# - - 'query(''id'').isint({min: 1, max: 9999})'
236-
# - - 'query(''id'').isInt({min: 1, max: 9999})'
237-
#
238-
# Remove all whitespace, so we can make our patterns easier to read
239-
#
240-
preprocessing:
241-
-
242-
- |-
243-
\s*
244-
- ""
245-
# -
246-
# - |-
247-
# (\\s\*)?\s+(\\s\*)?
248-
# - "\\s*"
249-
# debug: true
250-
</script>
25189
<!--
25290
25391
-->

docs/labs/regex1.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
info2 =
1+
info =
22
{
33
hints: [
44
{
@@ -149,7 +149,7 @@ info2 =
149149
{
150150
absent: String.raw`\\z$`,
151151
"index": 4,
152-
text: "This is Ruby. Use \\z at the beginning."
152+
text: "This is Ruby. Use \\z at the end."
153153
},
154154
{
155155
absent: String.raw`\[A-Z\]`,

0 commit comments

Comments
 (0)