Creates an optimized regex to match all known top level domains.
The optimized regex is stored in $modSettings['tld_regex'].
To update the stored version of the regex to use the latest list of valid TLDs from iana.org, set
the $update parameter to true. Updating can take some time, based on network connectivity, so it
should normally only be done by calling this function from a background or scheduled task.
If $update is not true, but the regex is missing or invalid, the regex will be regenerated from a
hard-coded list of TLDs. This regenerated regex will be overwritten on the next scheduled update.