src code

instance method String#sub

String#sub(pattern, replacement[, count = 1]) → String

Returns a string with the first count occurrences of pattern replaced by either a regular string, the returned value of a function or a Template string. The pattern can be a string or a regular expression.