<para>
Note that assigning a string to a zero-length substring will simply insert
the a string into another string. Reversely, assigning an empty string to a
-substring will remove the characters from the original string. This property
-can be used to truncate a string to its first n characters by:
+substring will remove the characters from the original string.
+</para>
+<example>
+String x = "abcdefghijkl";
+String y = "12345678";
+
+x(3,0) = y; // x = "abc12345678defghijkl"
+x(11,5) = ""; // x = "abc12345678ijkl"
+</example>
+<para>
+This property can be used to truncate a string to its first n characters by:
</para>
<example>
x(n, ~x-n) = "";
first whitespace character.
</para>
</section>
+
+<section>
+<heading>Regular Expressions</heading>
+<para>
+Regular expressions are handled by objects of class <code>regex</code>.
+Constructors allow the creation of regex objects from <code>String</code> objects,
+literal strings or other regex objects.
+</para>
+<example>
+String pattern("[a-z]+");
+regex word(pattern);
+regex number("[0-9]+");
+regex nr(number);
+</example>
+<para>
+Regular expressions are primarily used to find patterns in text strings.
+The <strong>==</strong> operator performs the pattern matching.
+A relational expression returns true if the String matches the pattern,
+i.e. the pattern matches some part of the text in the String object.
+</para>
+<example>
+regex nr("[0-9]+");
+String x("abcdef"");
+String y("abc123def");
+
+x == nr; // false
+nr == y; // true
+</example>
+<para>
+A regular expression can be used in a substring expression.
+The substring selected from the target string is the first part
+that matches the regular expression.
+</para>
+<example>
+regex nr("[0-9]+");
+String y("abc123def456ghi");
+
+x = y(nr); // x = 123
+</example>
+</section>
<section>
-<heading>SEE ALSO</heading>
+<heading>See Also</heading>
<itemize>
<item> Bjarne Stroustrup, Section 6.9 </item>
<item> DDJ October 1991, pg 24 </item>