The following rules govern the application of regular expressions.
As stated previously, a regular expression always matches the longest possible string, starting as far toward the beginning of the line as possible. For example, given the following string,
This (rug) is not what it once was (a long time ago), is it?
the expression /Th.*is/ matches
This (rug) is not what it once was (a long time ago), is
and /(.*)/ matches
(rug) is not what it once was (a long time ago)
However, /([^)]*)/ matches
Given the following string,
singing songs, singing more and more
the expression /s.*ing/ matches
singing songs, singing
and /s.*ing song/ matches
Within some utilities, ...