JavaScript From Beginner To Advanced
0% completed
Previous
Next
Course
Discussions
Quiz
What does the regular expression '/^a...s$/' match?
A
Any string that starts with 'a' and ends with 's' with exactly three characters in between.
B
Any string that starts with 'a' and ends with 's' with at least three characters in between.
C
Any string that contains 'a' followed by any three characters and an 's' anywhere in the string.
D
Any string that starts and ends with any characters and contains 'a' followed by 's'.
Reset Quiz
Check Answer
Which method is used to test for a match in a string?
A
RegExp.match()
B
RegExp.exec()
C
RegExp.test()
D
String.find()
Reset Quiz
Check Answer
What is the output of the following code? console.log(/abc/.test('abcde'));
A
undefined
B
0
C
true
D
false
Reset Quiz
Check Answer
Which flag is used with a regular expression to make it case-insensitive?
A
g
B
m
C
i
D
s
Reset Quiz
Check Answer
What does the following regular expression match?
/[\d]{2,4}/
A
Exactly two to four digits
B
Two to four non-digit characters
C
At least two, but no more than four, digits
D
Any number, with digits in groups of two to four
Reset Quiz
Check Answer
Which regular expression will find all instances of the word "the" regardless of case in a string?
A
/the/g
B
/the/i
C
/the/gi
D
/^the$/gi
Reset Quiz
Check Answer
How do you use a regular expression to match any character except newline?
Choose all correct options
/.+/
/./
/.*/
/[^.\n]/
Reset Quiz
Check Answer
What does the '?' character signify in a regular expression?
A
The preceding character is optional and may appear zero or one time.
B
It marks the start of a non-capturing group.
C
It is used as a quantifier to indicate one or more times.
D
The backslash \ is used to escape special characters to treat them as literals, not '?'.
Reset Quiz
Check Answer
.....
.....
.....
Like the course? Get enrolled and start learning!
Enroll
Previous
Next