Intermediate Ruby
Q67 / 100

What does "String#gsub(pattern, replacement)" do?

Correct! Well done.

Incorrect.

The correct answer is B) Replaces all occurrences of pattern in the string with replacement, returning a new string

B

Correct Answer

Replaces all occurrences of pattern in the string with replacement, returning a new string

Explanation

gsub (global substitution) replaces every match of the pattern (string or regex) with the replacement, returning a new string; sub replaces only the first match.

Progress
67/100