1/29
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Regular Expressions
______ are patterns that are used for matching and manipulating strings according to specified rules
POSIX Extended
Perl Compatible Regular Expressions
PHP supports two types of regular expressions:
preg_match()
Pass to the _____ the regular expression pattern as the first argument and a string containing the text you want to search as the second argument
regular expression pattern
A ______ is a special text string that describes a search pattern
metacharacters
Regular expression patterns consist of literal characters and ______, which are special characters that define the pattern- matching rules
forward slash (/)
Regular expression patterns are enclosed in opening and closing delimiters. The most common character delimiter is the _____
period (.)
A ______ in a regular expression pattern specifies that the pattern must contain a value at the location of the _____
0, 1
A return value of __ indicates that the string does not match the pattern and __ if it does
anchor
An ____ specifies that the pattern must appear at a particular position in a string
^, $
The ___ metacharacter anchors characters to the beginning of a string. The ___ metacharacter anchors characters to the end of a string
backslash
To match any metacharacters as literal values in a regular expression, escape the character with a _____
quantifiers
Metacharacters that specify the quantity of a match are called _____
question mark (?)
A ______ quantifier specifies that the preceding character in the pattern is optional
addition(+)
The _____ quantifier specifies that one or more sequential occurrences of the preceding characters match
asterisk (*)
A ______ quantifier specifies that zero or more sequential occurrences of the preceding characters match
{ }
The____ quantifiers specify the number of times that a character must repeat sequentially
subexpression, subpattern
When a set of characters enclosed in parentheses are treated as a group, they are referred to as a _____ or ______
Character classes
_____ in regular expressions treat multiple characters as a single item
([])
Characters enclosed with the____ metacharacters represent alternate characters that are allowed in a pattern match
hyphen metacharacter (-)
The ______ specifies a range of values in a character class
^
The __ metacharacter (placed immediately after the opening bracket of a character class) specifies optional characters to exclude in a pattern match
|
The __ metacharacter is used to specify an alternate set of patterns
OR
The | metacharacter is essentially the same as using the ___ operator to perform multiple evaluations in a conditional expression
Pattern modifiers
_____ are letters placed after the closing delimiter that change the default rules for interpreting matches
i
m
s
o
The pattern modifier, __, indicates that the case of the letter does not matter when searching
The pattern modifier, __, allows searches across newline characters
The pattern modifier, __, changes how the . (period) metacharacter works
The pattern modifier, __, evaluates the expression only once
Character classes
_____ specify an entire range of characters, for example, the alphabet or an integer set
[[:alpha:]]
It matches any string containing alphabetic characters aA through zZ.
[[:digit:]]
It matches any string containing numerical digits 0 through 9.
[[:alnum:]]
It matches any string containing alphanumeric characters aA through zZ and 0 through 9
[[:space:]]
It matches any string containing a space.