0
0
Nginxdevops~10 mins

Regex match (~, ~*) in Nginx - 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 URLs ending with .jpg using a case-sensitive regex.

Nginx
location ~ [1] { }
Drag options to blanks, or click blank then click option'
A\.jpg$
B^jpg$
Cjpg$
D\.JPG$
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting to escape the dot in the regex.
Using case-insensitive operator (~*) instead of case-sensitive (~).
2fill in blank
medium

Complete the code to match URLs ending with .PNG or .png using a case-insensitive regex.

Nginx
location ~* [1] { }
Drag options to blanks, or click blank then click option'
A\.PNG$
Bpng$
C\.png$
D^png$
Attempts:
3 left
💡 Hint
Common Mistakes
Not escaping the dot.
Using ~ instead of ~* for case-insensitive matching.
3fill in blank
hard

Fix the error in the code to correctly match URLs starting with /images/ using a case-sensitive regex.

Nginx
location ~ [1] { }
Drag options to blanks, or click blank then click option'
Aimages/
B^/images/
C^images$
D/images/
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the caret ^ causes matching anywhere in the string.
Missing the leading slash in the pattern.
4fill in blank
hard

Fill both blanks to match URLs ending with .css or .js using a case-insensitive regex.

Nginx
location ~* [1] { } # matches files ending with [2]
Drag options to blanks, or click blank then click option'
A\.(css|js)$
B\.(jpg|png)$
C.css$
D.js$
Attempts:
3 left
💡 Hint
Common Mistakes
Using separate patterns for .css and .js instead of combined.
Not escaping the dot.
5fill in blank
hard

Fill all three blanks to match URLs starting with /api/ followed by digits, case-sensitive.

Nginx
location ~ [1][2][3] { }
Drag options to blanks, or click blank then click option'
A^/api/
B\d+
C$
D[a-z]+
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting anchors causes partial matches.
Using wrong character classes for digits.