Using Regions

A Matcher object finds matches in a subset of its input string called a region. The default region for a Matcher object is always the entirety of the input string. However, you can change the start and end points of a region by using the region method, and you can query the region’s end points by using the regionStart and regionEnd methods.

The region method requires both a start and an end value. The following examples show how to set one value without setting the other.