UPDATE `redcap_validation_types` SET 
	`regex_js` = '/^(?!\\.)((?!.*\\.{2})[a-zA-Z0-9\\u0080-\\u00FF\\u0100-\\u017F\\u0180-\\u024F\\u0250-\\u02AF\\u0300-\\u036F\\u0370-\\u03FF\\u0400-\\u04FF\\u0500-\\u052F\\u0530-\\u058F\\u0590-\\u05FF\\u0600-\\u06FF\\u0700-\\u074F\\u0750-\\u077F\\u0780-\\u07BF\\u07C0-\\u07FF\\u0900-\\u097F\\u0980-\\u09FF\\u0A00-\\u0A7F\\u0A80-\\u0AFF\\u0B00-\\u0B7F\\u0B80-\\u0BFF\\u0C00-\\u0C7F\\u0C80-\\u0CFF\\u0D00-\\u0D7F\\u0D80-\\u0DFF\\u0E00-\\u0E7F\\u0E80-\\u0EFF\\u0F00-\\u0FFF\\u1000-\\u109F\\u10A0-\\u10FF\\u1100-\\u11FF\\u1200-\\u137F\\u1380-\\u139F\\u13A0-\\u13FF\\u1400-\\u167F\\u1680-\\u169F\\u16A0-\\u16FF\\u1700-\\u171F\\u1720-\\u173F\\u1740-\\u175F\\u1760-\\u177F\\u1780-\\u17FF\\u1800-\\u18AF\\u1900-\\u194F\\u1950-\\u197F\\u1980-\\u19DF\\u19E0-\\u19FF\\u1A00-\\u1A1F\\u1B00-\\u1B7F\\u1D00-\\u1D7F\\u1D80-\\u1DBF\\u1DC0-\\u1DFF\\u1E00-\\u1EFF\\u1F00-\\u1FFF\\u20D0-\\u20FF\\u2100-\\u214F\\u2C00-\\u2C5F\\u2C60-\\u2C7F\\u2C80-\\u2CFF\\u2D00-\\u2D2F\\u2D30-\\u2D7F\\u2D80-\\u2DDF\\u2F00-\\u2FDF\\u2FF0-\\u2FFF\\u3040-\\u309F\\u30A0-\\u30FF\\u3100-\\u312F\\u3130-\\u318F\\u3190-\\u319F\\u31C0-\\u31EF\\u31F0-\\u31FF\\u3200-\\u32FF\\u3300-\\u33FF\\u3400-\\u4DBF\\u4DC0-\\u4DFF\\u4E00-\\u9FFF\\uA000-\\uA48F\\uA490-\\uA4CF\\uA700-\\uA71F\\uA800-\\uA82F\\uA840-\\uA87F\\uAC00-\\uD7AF\\uF900-\\uFAFF\\.!#$%&\'*+-/=?^_`{|}~\\-\\d]+)@(?!\\.)([a-zA-Z0-9\\u0080-\\u00FF\\u0100-\\u017F\\u0180-\\u024F\\u0250-\\u02AF\\u0300-\\u036F\\u0370-\\u03FF\\u0400-\\u04FF\\u0500-\\u052F\\u0530-\\u058F\\u0590-\\u05FF\\u0600-\\u06FF\\u0700-\\u074F\\u0750-\\u077F\\u0780-\\u07BF\\u07C0-\\u07FF\\u0900-\\u097F\\u0980-\\u09FF\\u0A00-\\u0A7F\\u0A80-\\u0AFF\\u0B00-\\u0B7F\\u0B80-\\u0BFF\\u0C00-\\u0C7F\\u0C80-\\u0CFF\\u0D00-\\u0D7F\\u0D80-\\u0DFF\\u0E00-\\u0E7F\\u0E80-\\u0EFF\\u0F00-\\u0FFF\\u1000-\\u109F\\u10A0-\\u10FF\\u1100-\\u11FF\\u1200-\\u137F\\u1380-\\u139F\\u13A0-\\u13FF\\u1400-\\u167F\\u1680-\\u169F\\u16A0-\\u16FF\\u1700-\\u171F\\u1720-\\u173F\\u1740-\\u175F\\u1760-\\u177F\\u1780-\\u17FF\\u1800-\\u18AF\\u1900-\\u194F\\u1950-\\u197F\\u1980-\\u19DF\\u19E0-\\u19FF\\u1A00-\\u1A1F\\u1B00-\\u1B7F\\u1D00-\\u1D7F\\u1D80-\\u1DBF\\u1DC0-\\u1DFF\\u1E00-\\u1EFF\\u1F00-\\u1FFF\\u20D0-\\u20FF\\u2100-\\u214F\\u2C00-\\u2C5F\\u2C60-\\u2C7F\\u2C80-\\u2CFF\\u2D00-\\u2D2F\\u2D30-\\u2D7F\\u2D80-\\u2DDF\\u2F00-\\u2FDF\\u2FF0-\\u2FFF\\u3040-\\u309F\\u30A0-\\u30FF\\u3100-\\u312F\\u3130-\\u318F\\u3190-\\u319F\\u31C0-\\u31EF\\u31F0-\\u31FF\\u3200-\\u32FF\\u3300-\\u33FF\\u3400-\\u4DBF\\u4DC0-\\u4DFF\\u4E00-\\u9FFF\\uA000-\\uA48F\\uA490-\\uA4CF\\uA700-\\uA71F\\uA800-\\uA82F\\uA840-\\uA87F\\uAC00-\\uD7AF\\uF900-\\uFAFF\\-\\.\\d]+)((\\.([a-zA-Z\\u0080-\\u00FF\\u0100-\\u017F\\u0180-\\u024F\\u0250-\\u02AF\\u0300-\\u036F\\u0370-\\u03FF\\u0400-\\u04FF\\u0500-\\u052F\\u0530-\\u058F\\u0590-\\u05FF\\u0600-\\u06FF\\u0700-\\u074F\\u0750-\\u077F\\u0780-\\u07BF\\u07C0-\\u07FF\\u0900-\\u097F\\u0980-\\u09FF\\u0A00-\\u0A7F\\u0A80-\\u0AFF\\u0B00-\\u0B7F\\u0B80-\\u0BFF\\u0C00-\\u0C7F\\u0C80-\\u0CFF\\u0D00-\\u0D7F\\u0D80-\\u0DFF\\u0E00-\\u0E7F\\u0E80-\\u0EFF\\u0F00-\\u0FFF\\u1000-\\u109F\\u10A0-\\u10FF\\u1100-\\u11FF\\u1200-\\u137F\\u1380-\\u139F\\u13A0-\\u13FF\\u1400-\\u167F\\u1680-\\u169F\\u16A0-\\u16FF\\u1700-\\u171F\\u1720-\\u173F\\u1740-\\u175F\\u1760-\\u177F\\u1780-\\u17FF\\u1800-\\u18AF\\u1900-\\u194F\\u1950-\\u197F\\u1980-\\u19DF\\u19E0-\\u19FF\\u1A00-\\u1A1F\\u1B00-\\u1B7F\\u1D00-\\u1D7F\\u1D80-\\u1DBF\\u1DC0-\\u1DFF\\u1E00-\\u1EFF\\u1F00-\\u1FFF\\u20D0-\\u20FF\\u2100-\\u214F\\u2C00-\\u2C5F\\u2C60-\\u2C7F\\u2C80-\\u2CFF\\u2D00-\\u2D2F\\u2D30-\\u2D7F\\u2D80-\\u2DDF\\u2F00-\\u2FDF\\u2FF0-\\u2FFF\\u3040-\\u309F\\u30A0-\\u30FF\\u3100-\\u312F\\u3130-\\u318F\\u3190-\\u319F\\u31C0-\\u31EF\\u31F0-\\u31FF\\u3200-\\u32FF\\u3300-\\u33FF\\u3400-\\u4DBF\\u4DC0-\\u4DFF\\u4E00-\\u9FFF\\uA000-\\uA48F\\uA490-\\uA4CF\\uA700-\\uA71F\\uA800-\\uA82F\\uA840-\\uA87F\\uAC00-\\uD7AF\\uF900-\\uFAFF]){2,63})+)$/i', 
	`regex_php` = '/^(?!\\.)((?!.*\\.{2})[a-zA-Z0-9\\x{0080}-\\x{00FF}\\x{0100}-\\x{017F}\\x{0180}-\\x{024F}\\x{0250}-\\x{02AF}\\x{0300}-\\x{036F}\\x{0370}-\\x{03FF}\\x{0400}-\\x{04FF}\\x{0500}-\\x{052F}\\x{0530}-\\x{058F}\\x{0590}-\\x{05FF}\\x{0600}-\\x{06FF}\\x{0700}-\\x{074F}\\x{0750}-\\x{077F}\\x{0780}-\\x{07BF}\\x{07C0}-\\x{07FF}\\x{0900}-\\x{097F}\\x{0980}-\\x{09FF}\\x{0A00}-\\x{0A7F}\\x{0A80}-\\x{0AFF}\\x{0B00}-\\x{0B7F}\\x{0B80}-\\x{0BFF}\\x{0C00}-\\x{0C7F}\\x{0C80}-\\x{0CFF}\\x{0D00}-\\x{0D7F}\\x{0D80}-\\x{0DFF}\\x{0E00}-\\x{0E7F}\\x{0E80}-\\x{0EFF}\\x{0F00}-\\x{0FFF}\\x{1000}-\\x{109F}\\x{10A0}-\\x{10FF}\\x{1100}-\\x{11FF}\\x{1200}-\\x{137F}\\x{1380}-\\x{139F}\\x{13A0}-\\x{13FF}\\x{1400}-\\x{167F}\\x{1680}-\\x{169F}\\x{16A0}-\\x{16FF}\\x{1700}-\\x{171F}\\x{1720}-\\x{173F}\\x{1740}-\\x{175F}\\x{1760}-\\x{177F}\\x{1780}-\\x{17FF}\\x{1800}-\\x{18AF}\\x{1900}-\\x{194F}\\x{1950}-\\x{197F}\\x{1980}-\\x{19DF}\\x{19E0}-\\x{19FF}\\x{1A00}-\\x{1A1F}\\x{1B00}-\\x{1B7F}\\x{1D00}-\\x{1D7F}\\x{1D80}-\\x{1DBF}\\x{1DC0}-\\x{1DFF}\\x{1E00}-\\x{1EFF}\\x{1F00}-\\x{1FFF}\\x{20D0}-\\x{20FF}\\x{2100}-\\x{214F}\\x{2C00}-\\x{2C5F}\\x{2C60}-\\x{2C7F}\\x{2C80}-\\x{2CFF}\\x{2D00}-\\x{2D2F}\\x{2D30}-\\x{2D7F}\\x{2D80}-\\x{2DDF}\\x{2F00}-\\x{2FDF}\\x{2FF0}-\\x{2FFF}\\x{3040}-\\x{309F}\\x{30A0}-\\x{30FF}\\x{3100}-\\x{312F}\\x{3130}-\\x{318F}\\x{3190}-\\x{319F}\\x{31C0}-\\x{31EF}\\x{31F0}-\\x{31FF}\\x{3200}-\\x{32FF}\\x{3300}-\\x{33FF}\\x{3400}-\\x{4DBF}\\x{4DC0}-\\x{4DFF}\\x{4E00}-\\x{9FFF}\\x{A000}-\\x{A48F}\\x{A490}-\\x{A4CF}\\x{A700}-\\x{A71F}\\x{A800}-\\x{A82F}\\x{A840}-\\x{A87F}\\x{AC00}-\\x{D7AF}\\x{F900}-\\x{FAFF}\\.!#$%&\'*+-\\/=?^_`{|}~\\-\\d]+)@(?!\\.)([a-zA-Z0-9\\x{0080}-\\x{00FF}\\x{0100}-\\x{017F}\\x{0180}-\\x{024F}\\x{0250}-\\x{02AF}\\x{0300}-\\x{036F}\\x{0370}-\\x{03FF}\\x{0400}-\\x{04FF}\\x{0500}-\\x{052F}\\x{0530}-\\x{058F}\\x{0590}-\\x{05FF}\\x{0600}-\\x{06FF}\\x{0700}-\\x{074F}\\x{0750}-\\x{077F}\\x{0780}-\\x{07BF}\\x{07C0}-\\x{07FF}\\x{0900}-\\x{097F}\\x{0980}-\\x{09FF}\\x{0A00}-\\x{0A7F}\\x{0A80}-\\x{0AFF}\\x{0B00}-\\x{0B7F}\\x{0B80}-\\x{0BFF}\\x{0C00}-\\x{0C7F}\\x{0C80}-\\x{0CFF}\\x{0D00}-\\x{0D7F}\\x{0D80}-\\x{0DFF}\\x{0E00}-\\x{0E7F}\\x{0E80}-\\x{0EFF}\\x{0F00}-\\x{0FFF}\\x{1000}-\\x{109F}\\x{10A0}-\\x{10FF}\\x{1100}-\\x{11FF}\\x{1200}-\\x{137F}\\x{1380}-\\x{139F}\\x{13A0}-\\x{13FF}\\x{1400}-\\x{167F}\\x{1680}-\\x{169F}\\x{16A0}-\\x{16FF}\\x{1700}-\\x{171F}\\x{1720}-\\x{173F}\\x{1740}-\\x{175F}\\x{1760}-\\x{177F}\\x{1780}-\\x{17FF}\\x{1800}-\\x{18AF}\\x{1900}-\\x{194F}\\x{1950}-\\x{197F}\\x{1980}-\\x{19DF}\\x{19E0}-\\x{19FF}\\x{1A00}-\\x{1A1F}\\x{1B00}-\\x{1B7F}\\x{1D00}-\\x{1D7F}\\x{1D80}-\\x{1DBF}\\x{1DC0}-\\x{1DFF}\\x{1E00}-\\x{1EFF}\\x{1F00}-\\x{1FFF}\\x{20D0}-\\x{20FF}\\x{2100}-\\x{214F}\\x{2C00}-\\x{2C5F}\\x{2C60}-\\x{2C7F}\\x{2C80}-\\x{2CFF}\\x{2D00}-\\x{2D2F}\\x{2D30}-\\x{2D7F}\\x{2D80}-\\x{2DDF}\\x{2F00}-\\x{2FDF}\\x{2FF0}-\\x{2FFF}\\x{3040}-\\x{309F}\\x{30A0}-\\x{30FF}\\x{3100}-\\x{312F}\\x{3130}-\\x{318F}\\x{3190}-\\x{319F}\\x{31C0}-\\x{31EF}\\x{31F0}-\\x{31FF}\\x{3200}-\\x{32FF}\\x{3300}-\\x{33FF}\\x{3400}-\\x{4DBF}\\x{4DC0}-\\x{4DFF}\\x{4E00}-\\x{9FFF}\\x{A000}-\\x{A48F}\\x{A490}-\\x{A4CF}\\x{A700}-\\x{A71F}\\x{A800}-\\x{A82F}\\x{A840}-\\x{A87F}\\x{AC00}-\\x{D7AF}\\x{F900}-\\x{FAFF}\\-\\.\\d]+)((\\.([a-zA-Z\\x{0080}-\\x{00FF}\\x{0100}-\\x{017F}\\x{0180}-\\x{024F}\\x{0250}-\\x{02AF}\\x{0300}-\\x{036F}\\x{0370}-\\x{03FF}\\x{0400}-\\x{04FF}\\x{0500}-\\x{052F}\\x{0530}-\\x{058F}\\x{0590}-\\x{05FF}\\x{0600}-\\x{06FF}\\x{0700}-\\x{074F}\\x{0750}-\\x{077F}\\x{0780}-\\x{07BF}\\x{07C0}-\\x{07FF}\\x{0900}-\\x{097F}\\x{0980}-\\x{09FF}\\x{0A00}-\\x{0A7F}\\x{0A80}-\\x{0AFF}\\x{0B00}-\\x{0B7F}\\x{0B80}-\\x{0BFF}\\x{0C00}-\\x{0C7F}\\x{0C80}-\\x{0CFF}\\x{0D00}-\\x{0D7F}\\x{0D80}-\\x{0DFF}\\x{0E00}-\\x{0E7F}\\x{0E80}-\\x{0EFF}\\x{0F00}-\\x{0FFF}\\x{1000}-\\x{109F}\\x{10A0}-\\x{10FF}\\x{1100}-\\x{11FF}\\x{1200}-\\x{137F}\\x{1380}-\\x{139F}\\x{13A0}-\\x{13FF}\\x{1400}-\\x{167F}\\x{1680}-\\x{169F}\\x{16A0}-\\x{16FF}\\x{1700}-\\x{171F}\\x{1720}-\\x{173F}\\x{1740}-\\x{175F}\\x{1760}-\\x{177F}\\x{1780}-\\x{17FF}\\x{1800}-\\x{18AF}\\x{1900}-\\x{194F}\\x{1950}-\\x{197F}\\x{1980}-\\x{19DF}\\x{19E0}-\\x{19FF}\\x{1A00}-\\x{1A1F}\\x{1B00}-\\x{1B7F}\\x{1D00}-\\x{1D7F}\\x{1D80}-\\x{1DBF}\\x{1DC0}-\\x{1DFF}\\x{1E00}-\\x{1EFF}\\x{1F00}-\\x{1FFF}\\x{20D0}-\\x{20FF}\\x{2100}-\\x{214F}\\x{2C00}-\\x{2C5F}\\x{2C60}-\\x{2C7F}\\x{2C80}-\\x{2CFF}\\x{2D00}-\\x{2D2F}\\x{2D30}-\\x{2D7F}\\x{2D80}-\\x{2DDF}\\x{2F00}-\\x{2FDF}\\x{2FF0}-\\x{2FFF}\\x{3040}-\\x{309F}\\x{30A0}-\\x{30FF}\\x{3100}-\\x{312F}\\x{3130}-\\x{318F}\\x{3190}-\\x{319F}\\x{31C0}-\\x{31EF}\\x{31F0}-\\x{31FF}\\x{3200}-\\x{32FF}\\x{3300}-\\x{33FF}\\x{3400}-\\x{4DBF}\\x{4DC0}-\\x{4DFF}\\x{4E00}-\\x{9FFF}\\x{A000}-\\x{A48F}\\x{A490}-\\x{A4CF}\\x{A700}-\\x{A71F}\\x{A800}-\\x{A82F}\\x{A840}-\\x{A87F}\\x{AC00}-\\x{D7AF}\\x{F900}-\\x{FAFF}]){2,63})+)$/u' 
	WHERE `validation_name` = 'email';
ALTER TABLE `redcap_surveys` 
	ADD `response_limit` INT(7) NULL DEFAULT NULL,
	ADD `response_limit_include_partials` tinyint(1) NOT NULL DEFAULT '1',
	ADD `response_limit_custom_text` TEXT NULL DEFAULT NULL,
	ADD `survey_time_limit_days` smallint(3) NULL DEFAULT NULL,
	ADD `survey_time_limit_hours` tinyint(2) NULL DEFAULT NULL,
	ADD `survey_time_limit_minutes` tinyint(2) NULL DEFAULT NULL;
ALTER TABLE `redcap_surveys_participants` 
	ADD `link_expiration` DATETIME NULL DEFAULT NULL, 
	ADD `link_expiration_override` TINYINT(1) NOT NULL DEFAULT '0';
ALTER TABLE `redcap_surveys_scheduler_queue` CHANGE `reason_not_sent` `reason_not_sent` 
	ENUM('EMAIL ADDRESS NOT FOUND','PHONE NUMBER NOT FOUND','EMAIL ATTEMPT FAILED','UNKNOWN','SURVEY ALREADY COMPLETED','VOICE/SMS SETTING DISABLED','ERROR SENDING SMS','ERROR MAKING VOICE CALL','LINK HAD ALREADY EXPIRED') 
	CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT 'Explanation of why invitation did not send, if applicable';
INSERT INTO redcap_crons (cron_name, cron_description, cron_enabled, cron_frequency, cron_max_run_time, cron_instances_max, cron_instances_current, cron_last_run_end, cron_times_failed, cron_external_url) VALUES
	('CacheStatsReportingUrl', 'Generate the stats reporting URL and store it in the config table.', 'ENABLED', 10800, 1200, 1, 0, NULL, 0, NULL);
INSERT INTO redcap_config (field_name, value) VALUES ('report_stats_url', '');