Regular Expressions Basics quiz
Read and write common regex patterns used in search and validation.
Start the quiz
Enter your name and email. Your name appears on your free certificate, and your email is used to send your certificate details. The quiz has 20 questions. Each question has 4 or 8 options, and some ask you to choose more than one answer.
Regular expressions, often called regex, are compact patterns used to search, validate and replace text. They appear in code editors, command-line tools, web forms and log analysis. A small pattern can match a postcode, an email address or a date, which makes regex one of the most useful text skills to learn.
This quiz covers character classes, quantifiers, anchors, groups and the difference between matching a part of a string and matching the whole of it. Some questions ask for one pattern, while others ask you to select every pattern that matches a stated example.
Each hint explains why the correct patterns work and why the others fail. Complete the quiz to earn a certificate with your name, score and date, and keep practising with a regex tester to build confidence.
Build patterns one piece at a time. Start with a literal string, add a character class, then add a quantifier, testing each step in a regex tester with sample text. Try matching dates, postcodes and simple email shapes, and remember that greedy quantifiers can match more text than you expect, so check edge cases carefully.