Text is represented in Ruby by objects of the
String class. Strings are mutable objects, and the
String class defines a powerful set of
operators and methods for extracting substrings, inserting and deleting
text, searching, replacing, and so on. Ruby provides a number of ways to
express string literals in your programs, and some of them support a
powerful string interpolation syntax by which the values of arbitrary
Ruby expressions can be substituted into string literals. The sections
that follow explain string and character literals and string operators.
The full string API is covered in Strings.
Textual patterns are represented in Ruby as
and Ruby defines a syntax for including regular expressions literally in
your programs. The code
for example, represents a single lowercase letter followed by one or
more digits. Regular expressions are a commonly used feature of Ruby,
but regexps are not a fundamental datatype in the way that numbers,
strings, and arrays are. See Regular Expressions for
documentation of regular expression syntax and the
Ruby provides quite a few ways to embed strings literally ...