0
0
Redisquery~10 mins

KEYS pattern matching (avoid in production) in Redis - Interactive Code Practice

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

Complete the code to find all keys starting with 'user:'.

Redis
KEYS [1]
Drag options to blanks, or click blank then click option'
Auser:*
Buser?
C*user
Duser
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'user?' matches only keys with exactly one character after 'user'.
Using '*user' matches keys ending with 'user', not starting with it.
Using 'user' matches only the exact key 'user'.
2fill in blank
medium

Complete the code to find all keys that have exactly 5 characters.

Redis
KEYS [1]
Drag options to blanks, or click blank then click option'
A?????
B*
C????
D??????
Attempts:
3 left
💡 Hint
Common Mistakes
Using '*' matches any length, not exactly 5 characters.
Using fewer or more ? will match keys of wrong length.
3fill in blank
hard

Fix the error in the code to find keys ending with ':id'.

Redis
KEYS [1]
Drag options to blanks, or click blank then click option'
A*id:
B*:id
C:id*
Did:*
Attempts:
3 left
💡 Hint
Common Mistakes
Using ':id*' matches keys starting with ':id', not ending.
Using '*id:' or 'id:*' do not match keys ending with ':id'.
4fill in blank
hard

Fill both blanks to find keys that start with 'session:' and have exactly 8 characters after the colon.

Redis
KEYS [1][2]
Drag options to blanks, or click blank then click option'
Asession:
Buser:
C????????
D???????
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'user:' instead of 'session:' will match wrong keys.
Using 7 question marks matches 7 characters, not 8.
5fill in blank
hard

Fill all three blanks to find keys that contain 'cache' anywhere and end with a digit.

Redis
KEYS [1][2][3]
Drag options to blanks, or click blank then click option'
A*cache*
B*
C[0-9]
Dcache
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'cache' alone matches only keys exactly equal to 'cache'.
Using '*cache*' without [0-9] does not ensure the key ends with a digit.
Using '[0-9]' alone does not match keys containing 'cache'.