The regex module provides an implementation of regular expressions which adheres
closely to the POSIX Extended Regular Expressions (ERE) specification[0]. This
implementation computes matches in linear time.

By default, matches will be found anywhere in the given string. The ^ and $
characters can be used to anchor the match to the beginning or end of the
string.

find() returns a slice of [[capture]]s for the first match. The first
[[capture]] represents the entire matching string, while the rest represent the
matching substrings for the subexpressions, specified in the regular expression
using parentheses.

findall() finds all non-overlapping matches in the given string and returns
a slice of slices of [[capture]]s.

This module implements the POSIX match disambiguation rules by returning
the longest match among the leftmost matches.

	const re = regex::compile(`[Hh]are`)!;
	defer regex::finish(&re);

	const does_match = regex::test(&re, "Hello Hare, hello Hare.");
	fmt::printfln("matched? {}", does_match)!;

	const captures = regex::find(&re, "Hello Hare, hello Hare.");
	if (len(captures) != 0) {
		defer regex::free_captures(captures);
		// captures[0]: The full matching string.
		// captures[1...]: A capture for every capture group.
		fmt::printfln("{} ({}, {})", captures[0].content,
			captures[0].start,
			captures[0].end)!;
	};

	const matches = regex::findall(&re, "Hello Hare, hello Hare.");
	defer regex::free_matches(matches);
	// matches[0]: All captures for the first match.
	// matches[0][0]: The full matching string for the first match.
	// matches[0][1...]: A capture for every capture group in the
	//     first match.
	for (let i = 0z; i < len(matches); i += 1) {
		fmt::printfln("{} ({}, {})", matches[i][0].content,
			matches[i][0].start,
			matches[i][0].end)!;
	};

[0]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_04
