Regex Quiz

Questions: 16 · 10 minutes
1. With its default greedy behavior, what is the first match of /a.*b/ in ""a1b2b""?
a1b
a1b2b
1b2b
b2b
2. What is the first text matched by /\d+/ in the string ""Order 507 ready""?
Order
5
507
Order 507
3. Why does /^Hi/m match the string ""Bye\nHi""?
The m flag lets ^ match at the start of a line
The caret ignores all text before the letters H and i
A pattern without a dot automatically skips the first line
The m flag makes matching case-insensitive
4. Which input is a complete match for /^(cat|dog)$/?
The combined word “catdog”
The capitalized word “Dog”
The lowercase word “dog”
The plural word “dogs”
5. In JavaScript-style regex syntax, which string is matched by /^cat$/?
The phrase “a cat”
The exact string “cat”
The plural word “cats”
The word “cat” followed by a newline and “dog”
6. What kind of character does \s commonly match?
Any character except whitespace
Any lowercase letter
A punctuation mark only
A whitespace character such as a space or tab
7. Which input contains a match for /\bcat\b/?
concatenate
cat2
_cat_
A cat!
8. What is the first match of the lazy pattern /a.*?b/ in ""a1b2b""?
a1b
1b
a
a1b2b
9. Which single character is matched by /[A-F]/?
Uppercase D
Lowercase d
Uppercase G
The digit 7
10. The regex /(\d{4})-(\d{2})-(\d{2})/ matches ""2025-08-17"". What text is stored in capture group 2?
2025
08
17
2025-08-17
11. Which feature allows /^hello$/i to match the string ""HELLO""?
The start-of-string anchor
The end-of-string anchor
The delimiters surrounding the pattern
The case-insensitive i flag
12. Which string is matched completely by /^\d{3}-\d{2}$/?
12-345
12345
123-45
123-456
13. Which pair of strings is matched completely by /^colou?r$/?
“colours” and “color”
“colouur” and “colour”
“colo” and “color”
“color” and “colour”
14. Which pattern requires a string to end with the literal text "".txt""?
A wildcard dot followed by txt, with no end anchor
An escaped literal dot followed by txt and an end anchor
An escaped literal dot followed by txt, with no end anchor
The letters txt followed by a start anchor
15. What is the first match of /[^0-9]+/ in the string ""123abc456""?
123
456
abc
123abc
16. When /foo(?=bar)/ is executed on ""xxfoobarxx"", what text does the full match contain?
foo
bar
An empty string
foobar
Popular tests
Narcissistic Personality Inventory (NPI)
This self-report measure is used to assess narcissism as a personality trai…
Start Test
Yale-Brown Obsessive Compulsive Scale (Y-BOCS)
This measure is used to rapidly quantify the current severity of obsessive…
Start Test
CRAFFT Screening Test (CRAFFT 2.1)
This brief screening measure is designed to identify potential alcohol and…
Start Test
Patient Health Questionnaire-9 (PHQ-9)
This measure is commonly used to quickly screen for the presence and severi…
Start Test
Maslach Burnout Inventory (MBI)
This self-report measure is used to assess occupational burnout symptoms in…
Start Test
Adolescent Anxiety Questionnaire
This measure is designed to support a brief appraisal of anxiety symptoms a…
Start Test
Emotional Creativity Inventory (ECI)
This self-report measure assesses individual differences in the originality…
Start Test
Horne–Ostberg Morningness–Eveningness Questionnaire (MEQ)
Circadian preferences influence typical patterns of alertness and sleep tim…
Start Test
Ambivalent Sexism Inventory (ASI)
This measure is designed to assess attitudes toward women, including both o…
Start Test
Internalized Misogyny Scale (IMS)
This measure is designed to assess internalized negative beliefs and stereo…
Start Test
Perceived Stress Scale (PSS-10)
This self-report measure assesses the degree to which individuals appraise…
Start Test
Impulsive Behavior Scale (SUPPS-P)
Impulsivity is a multidimensional construct that is often assessed with bri…
Start Test
Clinical Institute Withdrawal Assessment for Alcohol, Revised (CIWA-Ar)
This rating scale is used to rapidly assess the severity of alcohol withdra…
Start Test
Positive and Negative Affect Schedule (PANAS)
This measure provides a brief self-report assessment of current or typical…
Start Test
Light Triad Scale (LTS)
This self-report measure assesses prosocial personality tendencies and orie…
Start Test
Suicidal Ideation Scale
In clinical settings, the Suicidal Ideation Scale is used to structure an i…
Start Test
Body Dysmorphic Disorder Scale (BDD-D)
This brief self-report measure is designed to screen for and quantify distr…
Start Test
Beck Anxiety Inventory (BAI)
This measure is a brief self-report inventory used to screen for anxiety sy…
Start Test
Differential Test of Perfectionism
This instrument is used to screen for perfectionism-related attitudes and t…
Start Test
Locus of Control Scale
This measure assesses generalized expectancies regarding the degree to whic…
Start Test
New Apathy Scale
This brief self-report measure is used to screen for apathy-related symptom…
Start Test
Perth Alexithymia Questionnaire (PAQ)
This measure assesses individual differences in alexithymia, including diff…
Start Test
Social Intelligence Scale
This brief self-report measure is designed to support rapid screening of in…
Start Test
Fear Test
This measure is designed to evaluate individual differences in fear-related…
Start Test
Neuroticism Level Scale
The measure is intended for brief screening of an individual’s propensity t…
Start Test
Aggressiveness Indicators Screening Questionnaire
This screening tool is designed to quickly identify behavioral indicators a…
Start Test