async function replaceAll() {
	terminateWorker();
	filesReplaced.length = 0;

	const search = $search.value;
	const replace = $replace.value;
	const options = getOptions();
	if (!search || !replace) return;
	const regex = toRegex(search, options);
	if (!regex) return;

	replacing = true;
	sendMessage("replace-files", filesSearched, regex, options, replace);
}
Replaces all occurrences of the search query with the replacement text in the files.
Sends a message to the worker threads to perform the replacement.