0
0
Bash Scriptingscripting~10 mins

Character classes ([a-z], [0-9]) in Bash Scripting - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to match all lowercase letters in the string.

Bash Scripting
echo "abc123" | grep -o '[[1]]'
Drag options to blanks, or click blank then click option'
AA-Z
Ba-z
C0-9
DA-Za-z
Attempts:
3 left
💡 Hint
Common Mistakes
Using uppercase letters range [A-Z] instead of lowercase.
Using digits range [0-9] which matches numbers, not letters.
2fill in blank
medium

Complete the code to match all digits in the string.

Bash Scripting
echo "abc123" | grep -o '[[1]]'
Drag options to blanks, or click blank then click option'
A0-9
Ba-z
CA-Z
Da-zA-Z
Attempts:
3 left
💡 Hint
Common Mistakes
Using letter ranges like [a-z] instead of digits.
Using uppercase letter ranges [A-Z] which do not match digits.
3fill in blank
hard

Fix the error in the code to match lowercase letters only.

Bash Scripting
echo "Hello123" | grep -o '[[1]]'
Drag options to blanks, or click blank then click option'
AA-Z
BA-Za-z
Ca-z
D0-9
Attempts:
3 left
💡 Hint
Common Mistakes
Using uppercase letters range [A-Z] which matches uppercase letters.
Using combined ranges like [A-Za-z] which matches both cases.
4fill in blank
hard

Fill both blanks to match lowercase letters and digits separately.

Bash Scripting
echo "a1b2c3" | grep -o '[[1]]' | sort | uniq && echo "a1b2c3" | grep -o '[[2]]' | sort | uniq
Drag options to blanks, or click blank then click option'
Aa-z
B0-9
CA-Z
Da-zA-Z
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing uppercase letters in the ranges.
Using the same range for both blanks.
5fill in blank
hard

Fill all three blanks to create a grep pattern matching lowercase letters, digits, and uppercase letters.

Bash Scripting
echo "aA1bB2cC3" | grep -o '[[1][2][3]]'
Drag options to blanks, or click blank then click option'
Aa-z
B0-9
CA-Z
D_
Attempts:
3 left
💡 Hint
Common Mistakes
Using underscores or other characters that do not match letters or digits.
Separating ranges into multiple character classes instead of combining.