function createExtensionRegExp(extensions) {
	if (extensions) {
		const normalizedExts = extensions.map(ext =>
			escapeRegExp(ext.startsWith(".") ? ext.slice(1) : ext),
		);

		return new RegExp(`.\\.(?:${normalizedExts.join("|")})$`, "u");
	}
	return null;
}
Create a `RegExp` object to detect extensions.
@param {string[] | null} extensions The extensions to create.
@returns {RegExp | null} The created `RegExp` object or null.