Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to match zero or more 'a' characters in the string.
Bash Scripting
echo 'aaaab' | grep -E 'a[1]b'
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' which requires at least one 'a'.
Using '?' which matches zero or one 'a' only.
✗ Incorrect
The '*' quantifier matches zero or more occurrences of the preceding character.
2fill in blank
mediumComplete the code to match one or more digits in the input.
Bash Scripting
echo '12345' | grep -E '[0-9][1]'
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '*' which allows zero digits, so it matches empty strings.
Using '?' which matches zero or one digit only.
✗ Incorrect
The '+' quantifier matches one or more occurrences of the preceding pattern.
3fill in blank
hardComplete the code to match zero or one 'a' followed by 'b'.
Bash Scripting
echo 'ab' | grep -E 'a[1]b'
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' which requires at least one 'a'.
Using '*' which allows any number including many 'a's.
✗ Incorrect
The '?' quantifier matches zero or one occurrence of the preceding character.
4fill in blank
hardFill both blanks to match a string starting with one or more 'x' followed by zero or one 'y'.
Bash Scripting
echo 'xxxy' | grep -E '^x[1]y[2]$'
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '*' for 'x' which allows zero 'x's, but we want at least one.
Using '+' for 'y' which requires at least one 'y'.
✗ Incorrect
Use '+' to match one or more 'x' and '?' to match zero or one 'y'.
5fill in blank
hardFill all three blanks to match a string with zero or more 'a's, followed by one or more 'b's, then zero or one 'c'.
Bash Scripting
echo 'aaabbc' | grep -E '^a[1]b[2]c[3]$'
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '+' for 'a' which requires at least one 'a'.
Using '*' for 'b' which allows zero 'b's but we need at least one.
Using '+' for 'c' which requires at least one 'c'.
✗ Incorrect
Use '*' for zero or more 'a's, '+' for one or more 'b's, and '?' for zero or one 'c'.