Exam 7: Working With Regular Expressions

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Regular expressions facilitate text substitution operations. However, regular expressions are not able to accommodate differences in case.

(True/False)
4.9/5
(41)

By default, regular expression matches are case sensitive, although you can override this behavior.

(True/False)
4.8/5
(33)

The ^ character is used in a regular expression to look for a match at the end of a line.

(True/False)
4.7/5
(36)

A regular expression is ____.

(Multiple Choice)
4.9/5
(40)

A metacharacter is a character that alters the way a pattern match occurs.

(True/False)
4.9/5
(41)

Which of the following regular expression metacharacters looks for a match at the end of a string?

(Multiple Choice)
4.9/5
(44)

Which of the following String methods can be used to replace all instances of a search pattern within a string?

(Multiple Choice)
4.7/5
(33)

The operator is the "equals to" operator in a regular expression.

(True/False)
4.9/5
(37)

Which of the following regular expression metacharacters matches any white space?

(Multiple Choice)
4.7/5
(43)

While you can certainly create scripts based on the assumption that the data received will always be valid, you would do so at your own peril. In most cases, you will want to build data validation logic into your own scripts, rejecting any data that is not the proper format.

(True/False)
4.9/5
(33)

Regular expressions are not limited to data validation. Regular expressions can also be used to search for data within strings and to perform string substitutions.

(True/False)
4.8/5
(41)

A ____ is a character that alters the way a pattern match occurs.

(Multiple Choice)
4.9/5
(46)

The result of the following example evaluates as true. if "Welcome to New York Harbor, USA." =~ /USA/ then puts "Welcome to America!" end

(True/False)
4.8/5
(38)

The * metacharacter modifier is used to set up pattern matches of zero or more instances of the preceding character.

(True/False)
4.9/5
(42)

Which of the following regular expression metacharacters matches any numeric character?

(Multiple Choice)
4.7/5
(37)

The $ character is used in a regular expression to set up a match with any character.

(True/False)
4.9/5
(36)

By default, if a character included in a regular expression pattern matches a character in the source string, true is returned.

(True/False)
4.9/5
(49)

The \s character is used in a regular expression to set up a match based on white space.

(True/False)
4.9/5
(38)

You can set up a regular expression pattern to look for possible matches using the | character to separate each possible match.

(True/False)
4.9/5
(50)

You can replace all instances of a search pattern using the String class's gsub method.

(True/False)
4.7/5
(42)
Showing 21 - 40 of 50
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)