FlashKeepers

Programming Concepts · College · College and University

Regular Expressions I: Fundamentals

Regex literals, character classes, quantifiers, anchors, groups, alternation and common flags.

About this set

36 basic cards for College Programming Concepts. Set 1 of 2 in Regular Expressions. It opens with "What does a regex literal represent?" and "What does the dot (.) metacharacter match in regex?". Study it alongside the other College sets below.

36 cards · basic cards · AI-written, checked twice. Edit anything.

Study this set free Look inside first Get FlashKeepers for iPhone

Opens in your browser, no account. Get the iPhone and iPad app · Android app

What does a regex literal represent?
Show answerA sequence of characters that defines a pattern to search for or match in text.
What does the dot (.) metacharacter match in regex?
Show answerAny single character except a newline (in standard mode).
How do you match a literal period in regex?
Show answerEscape it with a backslash: \.
What does the pipe | operator do in regex?
Show answerIt creates alternation, matching any one of the patterns separated by |.
What is a character class in regex?
Show answerA set of characters enclosed in square brackets [] that matches any single character in the set.
What does \d match in regex?
Show answerAny digit, 0 through 9.
What does \w match in regex?
Show answerAny word character: a-z, A-Z, 0-9, and underscore (_).
What does \s match in regex?
Show answerAny whitespace character: space, tab, newline, carriage return, or form feed.
What does [a-z] represent in regex?
Show answerAny single lowercase letter from a to z.
What does [^abc] represent in regex?
Show answerAny single character except a, b, or c (negation of the character class).
What does the + quantifier mean?
Show answerMatch one or more of the preceding element.
What does {n} mean as a quantifier?
Show answerMatch exactly n occurrences of the preceding element.
What does {n,m} mean as a quantifier?
Show answerMatch between n and m occurrences of the preceding element (inclusive).
How do you make a quantifier non-greedy?
Show answerAdd a ? after the quantifier (e.g., +?, *?, ??, {n,m}?).
What is the difference between greedy and non-greedy matching?
Show answerGreedy matches as much as possible; non-greedy matches as little as possible.

21 more cards in the app

Study this set free