src/vs/base/common/marshalling.ts/replacer
function replacer(key: string, value: any): any {
	// URI is done via toJSON-member
	if (value instanceof RegExp) {
		return {
			$mid: MarshalledId.Regexp,
			source: value.source,
			flags: regExpFlags(value),
		};
	}
	return value;
}