FREE! Click here to Join FunTrivia. Thousands of games, quizzes, and lots more!
Quiz about Regular Expressions 101
Quiz about Regular Expressions 101

Regular Expressions 101 Trivia Quiz


Regular expressions are the building blocks of text analysis, manipulation and search. This quiz demonstrates usage of a few basic ones. Find the one-to-one correspondence between the text on the right column and the regular expressions on the left one.

A matching quiz by gentlegiant17. Estimated time: 6 mins.
  1. Home
  2. »
  3. Quizzes
  4. »
  5. Science Trivia
  6. »
  7. Computers
  8. »
  9. General Computing

Time
6 mins
Type
Match Quiz
Quiz #
389,113
Updated
Dec 03 21
# Qns
10
Difficulty
Difficult
Avg Score
5 / 10
Plays
514
Awards
Editor's Choice
Last 3 plays: Guest 153 (7/10), Guest 91 (10/10), Guest 51 (1/10).
(a) Drag-and-drop from the right to the left, or (b) click on a right side answer box and then on a left side box to move it.
QuestionsChoices
1. AB?B?C?A  
  DAB
2. AB?C+E  
  ABCD
3. B*C[2-6]  
  ABDC
4. A..C  
  ABBA
5. ^A[BC]OD[EF]$  
  ABC1
6. ABC\d  
  ABCDE
7. (A|B)(B|C)[^D](C|D)$  
  ACE
8. [A-C][-AC][A-C]  
  CAB
9. [^A-C][-AC][A-C]  
  ABODE
10. A+B+C+D+E+  
  BBC6





Select each answer

1. AB?B?C?A
2. AB?C+E
3. B*C[2-6]
4. A..C
5. ^A[BC]OD[EF]$
6. ABC\d
7. (A|B)(B|C)[^D](C|D)$
8. [A-C][-AC][A-C]
9. [^A-C][-AC][A-C]
10. A+B+C+D+E+

Most Recent Scores
Dec 11 2024 : Guest 153: 7/10
Dec 01 2024 : Guest 91: 10/10
Nov 27 2024 : Guest 51: 1/10
Nov 26 2024 : Guest 185: 6/10
Nov 23 2024 : pommiejase: 3/10
Nov 23 2024 : Guest 185: 10/10
Nov 22 2024 : Guest 5: 1/10
Nov 08 2024 : twlmy: 10/10
Oct 25 2024 : Guest 51: 8/10

Score Distribution

quiz
Quiz Answer Key and Fun Facts
1. AB?B?C?A

Answer: ABBA

The "?" quantifier means a match of zero or one occurrences of the character preceding it. The regular expression "AB?B?C?A" is evaluated as follows: an "A" followed by zero or one "B"s followed by zero or one "B"s followed by zero or one "C"s followed by an "A". Thus, "ABBA" is a match.
2. AB?C+E

Answer: ACE

The "+" quantifier means a match of zero or more occurrences of the character preceding it. The regular expression "AB?C+E" is evaluated as follows: an "A" followed by zero or more "B"s followed by one or more "C"s followed by an "E". Thus, "ACE" is a match.
3. B*C[2-6]

Answer: BBC6

The "*" quantifier means a match of zero or more occurrences of the character preceding it. The "[]" quantifier means an occurrence of a character defined within the brackets. The regular expression "B*C[2-6]" is evaluated as follows: zero or more "B"s followed by a "C" followed by a digit in the range 2-6. Thus, "BBC6" is a match.
4. A..C

Answer: ABDC

The "." quantifier means a single occurrence of the any character. Hence, the regular expression "A..C" is evaluated as follows: an "A" followed by any two characters followed by a "C". Thus, "ABDC" is a match.
5. ^A[BC]OD[EF]$

Answer: ABODE

Best to interpret the regular expression "^A[BC]OD[EF]$" as we go along. The "^" quantifier means match a line starting with the character following it. So, we are looking for a match starting with an "A". The square brackets mandate a character from the selection within them hence the following letter should be a "B" or a "C". Next should come a hard coded "OD".

The last character of the line, signified by the "$" quantifier, must be an "E" or an "F". The word "ABODE" matches this complex criteria.
6. ABC\d

Answer: ABC1

The "\d" quantifier means an occurrence of a decimal digit. So the regular expression "ABC\d" is evaluated as follows: an "ABC" followed by a digit to which "ABC1" is a match. An alternative form of this regular expression would be "ABC[0-9]".
7. (A|B)(B|C)[^D](C|D)$

Answer: ABCD

The "|" quantifier means an occurrence of any one of the pipe-separated characters. The regular expression "(A|B)(B|C)[^D](C|D)$" is evaluated as follows: an "A" or a "B" followed by a "B" or a "C" followed by a character that's not "D" and ending with a "C" or a "D". From the options, only "ABCD" matches this pattern.
8. [A-C][-AC][A-C]

Answer: CAB

The "[]" quantifier means an occurrence of any character defined within the brackets. "[A-C]" refers to any character in the range A-C. "[-AC]" just means a "-" or an "A" or a "C". So, "CAB" is a match.
9. [^A-C][-AC][A-C]

Answer: DAB

The "[^]" quantifier means an occurrence of any character except the ones defined within the brackets. "[^A-C]" refers to any character except the ones in the range A-C. "[-AC]" just means a "-" or an "A" or a "C". "[A-C]" refers to any character in the range A-C. Thus, "DAB" is a match.
10. A+B+C+D+E+

Answer: ABCDE

The "+" quantifier means one or more occurrences of the character preceding it. Hence, the regular expression "A+B+C+D+E+" should be evaluated as an "ABCDE" string with possibly more of each letter adjacent to itself, with the mere "ABCDE" being a minimal match.
Source: Author gentlegiant17

This quiz was reviewed by FunTrivia editor WesleyCrusher before going online.
Any errors found in FunTrivia content are routinely corrected through our feedback system.
12/22/2024, Copyright 2024 FunTrivia, Inc. - Report an Error / Contact Us