User:Ohconfucius/AWB modules/mdy.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
This user script seems to have a documentation page at User:Ohconfucius/AWB modules/mdy. |
// <nowiki>
mw.loader.load('https://meta.wikimedia.org/w/index.php?title=User:Pathoschild/Scripts/Regex_menu_framework.js&action=raw&ctype=text/javascript');
function Ohc_AWB_mdy_test() {
var txt=document.editform.wpTextbox1;
//html, superscripted ordinals
////User:Ohconfucius/AWB modules/dmy
//protect dates
regex(/(\[\[September)( 11 attacks\|)/gi, '$1♫$2');
regex(/(100\s)(crore club\D)/gi, '$1♫$2');
// regex(/(september\s)(11\D)/gi, '$1♫$2');
//fix common errors
//rem superscripted ordinals
regex(/(\d)<sup>(th|st|nd|rd)<\/sup>/gi, '$1$2');
regex(/\[\[([12]?\d|30|31)(?:th|st|nd|rd|)(?:_| )(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)/gi, '[[$1 $2');
regex(/\[\[(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)(?:_| )([12]?\d|30|31)(?:th|st|nd|rd|)/gi, '[[$1 $2');
//month+day piped to month+day
regex(/\[\[(?:[12]?\d|30|31)(?:th|st|nd|rd|)\s(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\|(\d{1,2}\s)(?:th|st|nd|rd|)(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\]\]/gi, '[[$1$2]]');
regex(/\[\[(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s(?:[12]?\d|30|31)(?:th|st|nd|rd|)\|(\d{1,2}\s)(?:th|st|nd|rd|)(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\]\]/gi, '[[$1$2]]');
regex(/\[\[\d{1,2}\s(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\|(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)(\s\d{1,2})(?:th|st|nd|rd|)\]\]/gi, '[[$1$2]]');
regex(/\[\[(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s(?:[12]?\d|30|31)(?:th|st|nd|rd|)\|(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)(\s\d{1,2})(?:th|st|nd|rd|)\]\]/gi, '[[$1$2]]');
//month+day piped to number
regex(/\[\[(?:[12]?\d|30|31)(?:th|st|nd|rd|)\s(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\|(\d{1,4})\]\]/gi, '[[$1]]');
regex(/\[\[(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s(?:[12]?\d|30|31)(?:th|st|nd|rd|)\|(\d{1,4})\]\]/gi, '[[$1]]');
//fix 'bda' template redirect
regex(/{{bda\|([^}]+)}}/gi, '{{birth date and age|$1}}');
//part dates
//remove leading zeros from dts templates
regex(/({{dts\d?\|[^}]*\|)0([^}]*}})/gi, '$1$2');
//delink ISO dates
regex(/\[\[([12]\d{3}-\d\d-\d\d)\]\]/gi, '$1');
regex(/\[\[([12]\d{3})\]\]-\[\[(\d\d-\d\d)\]\]/gi, '$1-$2');
regex(/([12]\d{3})-\[\[(\d\d-\d\d)\]\]/gi, '$1-$2');
regex(/\[\[([12]\d{3})\]\]-(\d\d-\d\d)/gi, '$1-$2');
//remove year in xxxx
regex(/\[\[(?:1[7-9]|20)\d{2}\sin\s[^\|\]]+\|(\d{4})\]\]/gi, '$1');
//remove dts1 template that links ISO dates
regex(/\{\{dts1\|(\d{4}-\d\d-\d\d)\}\}/gi, '$1');
// century
regex(/\[\[((?:first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|eleventh|twelfth|thirteenth|fourteenth|fifteenth|sixteenth|seventeenth|eighteenth|nineteenth|twentieth|twenty(?:\s|-)first)(?:\s|-))century\]\]/gi, '$1century');
regex(/\[\[((?:first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|eleventh|twelfth|thirteenth|fourteenth|fifteenth|sixteenth|seventeenth|eighteenth|nineteenth|twentieth|twenty(?:\s|-)first)(?:\s|-))century\s(AD|BC|CE|BCE)\]\]/gi, '$1century');
regex(/\[\[(\d{1,2}(?:st|nd|rd|th)(?:\s|-))century\]\]/gi, '$1century');
regex(/\[\[(\d{1,2}(?:st|nd|rd|th)(?:\s|-))centuries\]\]/gi, '$1centuries');
regex(/\[\[\d{1,2}(?:st|nd|rd|th)(?:\s|-)century\|(\d{1,2}(?:st|nd|rd|th))\]\]/gi, '$1');
regex(/\[\[\d{1,2}(?:st|nd|rd|th)(?:\s|-)century\|(\d{1,2}(?:st|nd|rd|th)(?:\s|-))century\]\]/gi, '$1century');
regex(/\[\[\d{1,2}(?:st|nd|rd|th)(?:\s|-)century\|(\d{1,2}(?:st|nd|rd|th)(?:\s|-))centuries\]\]/gi, '$1centuries');
regex(/\[\[(\d{1,2}(?:st|nd|rd|th)(?:\s|-))century\s(AD|BC|CE|BCE)\]\]/gi, '$1century $2');
regex(/\[\[\d{1,2}(?:st|nd|rd|th)(?:\s|-)century\|(\d{1,2}(?:st|nd|rd|th)(?:\s|-))century\s(AD|BC|CE|BCE)\]\]/gi, '$1century $2');
regex(/\[\[\d{1,2}(?:st|nd|rd|th)(?:\s|-)century\|(\d{1,2}(?:st|nd|rd|th)(?:\s|-))centuries\s(AD|BC|CE|BCE)\]\]/gi, '$1centuries $2');
// decades and years
regex(/\[\[(\d{1,3}0)\'?s\]\]/gi, '$1s');
regex(/\[\[\d{1,3}0\'?s\|([^\]]{1,30})\]\]/gi, '$1');
regex(/\[\[(\d{1,3}0)\'?(s)?[\s_]?(AD|BC|CE|BCE)\]\]/gi, '$1$2 $3');
regex(/\[\[\d{1,3}0\'?s?[\s_]?(?:AD|BC|CE|BCE)\|([^\]]{1,30})\]\]/gi, '$1');
//year: now remove unprotected linked years
regex(/\[\[((?:1[0-9]|20)\d{2}|[1-9]\d{0,2})([\s_]?(?:AD|BC|CE|BCE)|)\]\]/gi, '$1$2');
regex(/\[\[\d{1,3}0\'?s?\s\(decade\)\|([^\]]{1,30})\]\]/gi, '$1');
regex(/(\d{1,3}0)\'?s/gi, '$1s');
// solitary day_numbers
regex(/\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}(?:th|st|nd|rd)\|(\d{1,2})(?:th|st|nd|rd)\]\]/gi, '$1');
regex(/\[\[\d{1,2}(?:th|st|nd|rd)\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\|(\d{1,2})(?:th|st|nd|rd)\]\]/gi, '$1');
regex(/\[\[(\d{1,2}(?:st|nd|rd|th))\]\]/gi, '$1');
//month+year
//Identify surprise or 'Easter egg' diversions linking month+years to year articles. Turn them into month+year links to be dealt with below
regex(/\[\[\d{1,4}#[^\|\]]+\|((?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{3,4})\]\]/gi, '[[$1]]');
regex(/\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{3,4})\]\]/gi, '$1');
regex(/\[\[(?:Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s\d{3,4}\|([^\]]{1,30})\]\]/gi, '$1');
//removed piped years when in full date
regex(/(\[\[\d{1,2}\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\]\],?\s?\[\[)[^\|\]]{1,32}\|(\d{1,4}\]\])/gi, '$1$2');
regex(/(\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}\]\],?\s?\[\[)[^\|\]]{1,32}\|(\d{1,4}\]\])/gi, '$1$2');
//remove piped years
regex(/\[\[(?:19\d|20[01])\d in (?:aviation|baseball|film|literature|comics|ireland|india)\|((?:19|20)\d{2})\]\]/gi, '$1');
//Identify surprise or 'Easter egg' diversions linking months to year articles.
regex(/\[\[\d{1,4}#[^\|\]]+\|(January|February|March|April|May|June|July|August|September|October|November|December)\]\]/gi, '$1');
//Month+day_number "March 7th" -> "March 7"
regex(/\[\[(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(\d?\d)(?:th|st|nd|rd)\]\]/gi, '[[$1 $2]]');
regex(/\[\[((?:Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s\d?\d)\]\](?:th|st|nd|rd)/gi, '[[$1]]');
regex(/\[\[(\d?\d)(?:th|st|nd|rd)\s(January|February|March|April|May|June|July|August|September|October|November|December)\]\]/gi, '$1 $2');
//Remove nbsp within date strings
regex(/(\D\d{1,3})(th|st|nd|rd) (?=\w)/gi, '$1$2 ');
regex(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)) (\d?\d(?:th|st|nd|rd|)\D)/gi, '$1 $2');
regex(/(\D\d?\d)(?:th|st|nd|rd|) (Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(?=\W)/gi, '$1 $2');
regex(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s* \s*((?:19\d|20[01])\d)(?=\D)/gi, '$1 $2');
//(month yyyy-month yy)
regex(/\((Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(20)([01]\d)\s?[-–]\s?(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s([01]\d)\)/gi, '($1 $2$3–$4 $2$5)');
regex(/\((Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(19)([3-9]\d)\s?[-–]\s?(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s([3-9]\d)\)/gi, '($1 $2$3–$4 $2$5)');
regex(/\((Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(19)(9\d)\s?[-–]\s?(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s([01]\d)\)/gi, '($1 $2$3–$4 20$5)');
regex(/(?:the\s?|)([1-2]?\d|30|31)(?:th|st|nd|rd|), ([1-2]?\d|30|31)(?:th|st|nd|rd|)(\s(?:and|&|to|or)\s[1-3]?\d)(?:th|st|nd|rd|)(?:\sof\s?)?\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(?=\W)/gi, '$1, $2$3 $4');
regex(/(?:the\s?|)([1-2]?\d|30|31)(?:th|st|nd|rd|)(\s(?:and|&|to|or)\s|[-–])([1-3]?\d)(?:th|st|nd|rd|)(?:\sof\s?)?\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(?=\W)/gi, '$1$2$3 $4');
regex(/(?:the\s?|)([1-2]?\d|30|31)(?:th|st|nd|rd|)(?:\sof\s?)\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(?=[^\|\]\w\d])/gi, '$1 $2');
regex(/(?:the\s?|)([1-2]?\d|30|31)(?:th|st|nd|rd|)(?:\sof\s?)?\s(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(?=\W)/gi, '$1 $2');
regex(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?:the\s|)([1-2]?\d|30|31)(?:th|st|nd|rd|),\s(?:the\s|)([1-2]?\d|30|31)(?:th|st|nd|rd|)(\s(?:and|&|to|or)\s)(?:the\s|)([1-2]?\d|30|31)(?:th|st|nd|rd|)(?=[^\]\|\w\d]\D)/gi, '$1 $2, $3$4 $5');
regex(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?:the\s|)([1-2]?\d|30|31)(?:th|st|nd|rd|)(\s(?:and|&|to|or)\s)(?:the\s|)([1-2]?\d|30|31)(?:th|st|nd|rd|)(?=[^\]\|\w\d]\D)/gi, '$1 $2$3$4');
regex(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s(?:the\s|)([1-3]?\d)(?:th|st|nd|rd)(?=[^\]\|\w\d]\D)/gi, '$1 $2');
regex(/(\s*=\s*)((?:19|20)\d\d)\s+(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s([1-3]?\d)(?=[\s\r\n]*[\|\}])/gi, '$1$4 $3 $2');
regex(/(\s*\()((?:19|20)\d\d)\s+(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s([1-3]?\d)(?=\))/gi, '$1$4 $3 $2');
//Month+day_number piped into number. Preferences do not work. They don't work in sequence because digits in the two dates must be adjacent
regex(/([^\[]{4})\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d?\d)\]\](\s?\-?\s?)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}(?:th|st|nd|rd)\|(\d{1,2}(?:th|st|nd|rd))\]\]/gi, '$1$2$3$4');
//same again but with ndash or mdash instead of hyphen
regex(/([^\[]{4})\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d?\d)\]\](\s?&[nm]dash;\s?)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}(?:th|st|nd|rd)\|(\d{1,2}(?:th|st|nd|rd))\]\]/gi, '$1$2$3$4');
//same again but with slash instead of hyphen
regex(/([^\[]{4})\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d?\d)\]\](\/)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}(?:th|st|nd|rd)\|(\d{1,2}(?:th|st|nd|rd))\]\]/gi, '$1$2$3$4');
regex(/([^\[]{4})\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d?\d)\]\](\s?\-?\s?)\[\[(\d{1,2}(?:th|st|nd|rd))\]\]/gi, '$1$2$3$4');
//same again but with ndash instead of hyphen
regex(/([^\[]{4})\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d?\d)\]\](\s?&[nm]dash;\s?)\[\[(\d{1,2})\]\]/gi, '$1$2$3$4');
//same again but with slash instead of hyphen
regex(/([^\[]{4})\[\[((?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d?\d)\]\](\/)\[\[(\d{1,2}(?:th|st|nd|rd))\]\]/gi, '$1$2$3$4');
regex(/([^\[]{4})\[\[(\d?\d)\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\]\](\s?\-?\s?)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}(?:th|st|nd|rd)\|(\d{1,2}(?:th|st|nd|rd))\]\]/gi, '$1$2$3$4');
//same again but with ndash instead of hyphen
regex(/([^\[]{4})\[\[(\d?\d)\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\]\](\s?&[nm]dash;\s?)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}(?:th|st|nd|rd)\|(\d{1,2}(?:th|st|nd|rd))\]\]/gi, '$1$2$3$4');
//same again but with slash instead of hyphen
regex(/([^\[]{4})\[\[(\d?\d)\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\]\](\/)\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}(?:th|st|nd|rd)\|(\d{1,2}(?:th|st|nd|rd))\]\]/gi, '$1$2$3$4');
regex(/([^\[]{4})\[\[(\d?\d)\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\]\](\s?\-?\s?)\[\[(\d{1,2}(?:th|st|nd|rd))\]\]/gi, '$1$2$3$4');
//same again but with ndash instead of hyphen
regex(/([^\[]{4})\[\[(\d?\d)\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\]\](\s?&[nm]dash;\s?)\[\[(\d{1,2}(?:th|st|nd|rd))\]\]/gi, '$1$2$3$4');
//same again but with slash instead of hyphen
regex(/([^\[]{4})\[\[(\d?\d)\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\]\](\/)\[\[(\d{1,2}(?:th|st|nd|rd))\]\]/gi, '$1$2$3$4');
regex(/\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}(?:th|st|nd|rd)\|(\d{1,2}(?:th|st|nd|rd))\]\]/gi, '$1');
regex(/\[\[\d{1,2}(?:th|st|nd|rd)\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\|(\d{1,2}(?:th|st|nd|rd))\]\]/gi, '$1');
regex(/\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}(?:th|st|nd|rd)\|((?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{1,2}(?:th|st|nd|rd))\]\]/gi, '$1');
//month+day piped into month+day or vice versa
regex(/\[\[\d{1,2}(?:th|st|nd|rd)\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\|((?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}(?:th|st|nd|rd))\]\]/gi, '$1');
regex(/\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s\d{1,2}(?:th|st|nd|rd)\|(\d{1,2}(?:th|st|nd|rd)\s(?:January|February|March|April|May|June|July|August|September|October|November|December))\]\]/gi, '$1');
//4 digit years piped into 2
regex(/\[\[\d{1,4}\|(\d{1,2}(?:th|st|nd|rd))\]\]/gi, '$1');
//full dates with incorrect 'year in'
regex(/(\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s(?:[0-3][\d]|[\d])\]\]),\s\[\[(\d{1,4})\sin\s[^\]]{1,32}\]\]/gi, '$1 $2');
regex(/(\[\[(?:[0-3][\d]|[\d])\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\]\])\s\[\[(\d{1,4})\sin\s[^\]]{1,32}\]\]/gi, '$1 $2');
regex(/(\[\[(?:[0-3][\d]|[\d])\s(?:January|February|March|April|May|June|July|August|September|October|November|December)\]\])\s{{(?:avyear|by|fy|ly|scy|sdy)\|(\d{1,4})}}/gi, '$1 [[$2]]');
regex(/(\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\s(?:[0-3][\d]|[\d])\]\]),\s\{\{(?:avyear|by|fy|ly|scy|sdy)\|(\d{1,4})\}\}/gi, '$1 [[$2]]');
//insert comma to separate date from army unit
regex(/(January|February|March|April|May|June|July|August|September|October|November|December) (the \d\d*@th (?:Air(?:borne|)|Arm(?:ou?red|y)|Artillery|Battalion|Brigade|Co(?:mpan|)y|Division|Fleet|Group|Infantry|Land|Panzer|Regiment|Squadron|Sqn)\b)/gi, '$1, $2');
// remove nowrap template from dm and md dates
regex(/(date=)\{\{nowrap\|(?:([0-2]?\d|30|31)(?:[ _]| )(January|February|March|April|May|June|July|August|September|October|November|December))\}\}/gi, '$1$2 $3');
regex(/(date=)\{\{nowrap\|(?:(January|February|March|April|May|June|July|August|September|October|November|December)(?:[ _]| )([0-2]?\d|30|31))\}\}/gi, '$1$2 $3');
//remove leading zero from linked date
regex(/\[\[(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s0(\d)(?:th|st|nd|rd|)\]\]/gi, '[[$1 $2]]');
regex(/\[\[0(\d)(?:th|st|nd|rd|)\s(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\]\]/gi, '[[$1 $2]]');
//delink dates; strip ordinals
regex(/\[\[(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s(\d?\d)(?:th|st|nd|rd|)(?:\]\],?\s?\[\[|,?\s)(\d{1,4})\]\]/gi, '$1 $2, $3');
regex(/\[\[(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s(\d?\d)(?:th|st|nd|rd|)\]\],?\s?(\d{1,4})(\W)/gi, '$1 $2, $3$4');
regex(/\[\[(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s(\d?\d)(?:th|st|nd|rd|)\]\]/gi, '$1 $2');
regex(/\[\[(\d?\d)(?:th|st|nd|rd|)\s(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)(?:\]\],?\s?\[\[|,?\s)(\d{1,4})\]\]/gi, '$1 $2 $3');
regex(/\[\[(\d?\d)(?:th|st|nd|rd|)\s(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\]\],?\s?(\d{1,4})(\W)/gi, '$1 $2 $3$4');
regex(/\[\[(\d?\d)(?:th|st|nd|rd|)\s(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\]\]/gi, '$1 $2');
//change deprecated birth and death templates
regex(/\|df=ye?s?/gi, '');
// regex(/(\{\{(?:Birth|Death|launch|release|start|end|film date|Wayback)[^\}\|]*\|)/gi, '$1df=yes|');
// regex(/(\{\{(?:Birth|Death|launch|release|start|end|film date|Wayback)[^\}\|]*\|)df=ye?s?\|([^}]*df=ye?s?)/gi, '$1$2');
//Slashes
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?1\/([12]\d{3})(?![\w\d-])/gi, '$1 January $2, $3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?2\/([12]\d{3})(?![\w\d-])/gi, '$1 February $2, $3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?3\/([12]\d{3})(?![\w\d-])/gi, '$1 March $2, $3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?4\/([12]\d{3})(?![\w\d-])/gi, '$1 April $2, $3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?5\/([12]\d{3})(?![\w\d-])/gi, '$1 May $2, $3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?6\/([12]\d{3})(?![\w\d-])/gi, '$1 June $2, $3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?7\/([12]\d{3})(?![\w\d-])/gi, '$1 July $2, $3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?8\/([12]\d{3})(?![\w\d-])/gi, '$1 August $2, $3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?9\/([12]\d{3})(?![\w\d-])/gi, '$1 September $2, $3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/10\/([12]\d{3})(?![\w\d-])/gi, '$1 October $2, $3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/11\/([12]\d{3})(?![\w\d-])/gi, '$1 November $2, $3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/12\/([12]\d{3})(?![\w\d-])/gi, '$1 December $2, $3');
//2-digit year – UK style
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?1\/([4-9]\d)(?![\w\d-])/gi, '$1 January $2, 19$3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?2\/([4-9]\d)(?![\w\d-])/gi, '$1 February $2, 19$3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?3\/([4-9]\d)(?![\w\d-])/gi, '$1 March $2, 19$3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?4\/([4-9]\d)(?![\w\d-])/gi, '$1 April $2, 19$3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?5\/([4-9]\d)(?![\w\d-])/gi, '$1 May $2, 19$3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?6\/([4-9]\d)(?![\w\d-])/gi, '$1 June $2, 19$3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?7\/([4-9]\d)(?![\w\d-])/gi, '$1 July $2, 19$3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?8\/([4-9]\d)(?![\w\d-])/gi, '$1 August $2, 19$3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?9\/([4-9]\d)(?![\w\d-])/gi, '$1 September $2, 19$3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/10\/([4-9]\d)(?![\w\d-])/gi, '$1 October $2, 19$3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/11\/([4-9]\d)(?![\w\d-])/gi, '$1 November $2, 19$3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/12\/([4-9]\d)(?![\w\d-])/gi, '$1 December $2, 19$3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?1\/([01]\d)(?![\w\d-])/gi, '$1 January $2, 20$3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?2\/([01]\d)(?![\w\d-])/gi, '$1 February $2, 20$3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?3\/([01]\d)(?![\w\d-])/gi, '$1 March $2, 20$3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?4\/([01]\d)(?![\w\d-])/gi, '$1 April $2, 20$3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?5\/([01]\d)(?![\w\d-])/gi, '$1 May $2, 20$3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?6\/([01]\d)(?![\w\d-])/gi, '$1 June $2, 20$3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?7\/([01]\d)(?![\w\d-])/gi, '$1 July $2, 20$3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?8\/([01]\d)(?![\w\d-])/gi, '$1 August $2, 20$3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/0?9\/([01]\d)(?![\w\d-])/gi, '$1 September $2, 20$3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/10\/([01]\d)(?![\w\d-])/gi, '$1 October $2, 20$3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/11\/([01]\d)(?![\w\d-])/gi, '$1 November $2, 20$3');
regex(/([^\w-])(1[3-9]|[2-3]\d)\/12\/([01]\d)(?![\w\d-])/gi, '$1 December $2, 20$3');
//numerical format with hyphens and dashes (dd-mm-yyyy) to mdy
regex(/(\s*=\s*)([0-2]?\d|30|31)[\-–]0?1[\-–]([1-2]\d{3})(?=\s*[\|\}])/gi, '$1January $2, $3');
regex(/(\s*=\s*)([0-2]?\d)[\-–]0?2[\-–]([1-2]\d{3})(?=\s*[\|\}])/gi, '$1February $2, $3');
regex(/(\s*=\s*)([0-2]?\d|30|31)[\-–]0?3[\-–]([1-2]\d{3})(?=\s*[\|\}])/gi, '$1March $2, $3');
regex(/(\s*=\s*)([0-2]?\d|30|31)[\-–]0?4[\-–]([1-2]\d{3})(?=\s*[\|\}])/gi, '$1April $2, $3');
regex(/(\s*=\s*)([0-2]?\d|30|31)[\-–]0?5[\-–]([1-2]\d{3})(?=\s*[\|\}])/gi, '$1May $2, $3');
regex(/(\s*=\s*)([0-2]?\d|30|31)[\-–]0?6[\-–]([1-2]\d{3})(?=\s*[\|\}])/gi, '$1June $2, $3');
regex(/(\s*=\s*)([0-2]?\d|30|31)[\-–]0?7[\-–]([1-2]\d{3})(?=\s*[\|\}])/gi, '$1July $2, $3');
regex(/(\s*=\s*)([0-2]?\d|30|31)[\-–]0?8[\-–]([1-2]\d{3})(?=\s*[\|\}])/gi, '$1August $2, $3');
regex(/(\s*=\s*)([0-2]?\d|30|31)[\-–]0?9[\-–]([1-2]\d{3})(?=\s*[\|\}])/gi, '$1September $2, $3');
regex(/(\s*=\s*)([0-2]?\d|30|31)[\-–]10[\-–]([1-2]\d{3})(?=\s*[\|\}])/gi, '$1October $2, $3');
regex(/(\s*=\s*)([0-2]?\d|30|31)[\-–]11[\-–]([1-2]\d{3})(?=\s*[\|\}])/gi, '$1November $2, $3');
regex(/(\s*=\s*)([0-2]?\d|30|31)[\-–]12[\-–]([1-2]\d{3})(?=\s*[\|\}])/gi, '$1December $2, $3');
//improperly formatted access dates with endashes (yyyy–mm–dd) and/or missing zeros to ISO
regex(/(\|[ ]*accessdate[ ]*=[ ]*)([1-2]\d{3})[–—]([0-2]?\d)[–—]([0-2]?\d|30|31)(?=\s*[\|\}])/gi, '$1$2-$3-$4'); //ndashes and emdashes
regex(/(\|[ ]*accessdate[ ]*=[ ]*)([1-2]\d{3})-(\d)-([0-2]\d|30|31)(?=\s*[\|\}])/gi, '$1$2-0$3-$4'); //ndashes and emdashes
regex(/(\|[ ]*accessdate[ ]*=[ ]*)([1-2]\d{3})-([0-1]\d)-(\d)(?=\s*[\|\}])/gi, '$1$2-$3-0$4'); //ndashes and emdashes
regex(/(\|[ ]*accessdate[ ]*=[ ]*)([1-2]\d{3})-(\d)-(\d)(?=\s*[\|\}])/gi, '$1$2-0$3-0$4'); //ndashes and emdashes
//improperly formatted dates with endashes (yyyy–mm–dd) and/or missing zeros to dmy
regex(/(\s*=\s*)([1-2]\d{3})–0?1–([0-2]?\d|30|31)(?=\s*[\|\}])/gi, '$1January $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})–0?2–([0-2]?\d)(?=\s*[\|\}])/gi, '$1February $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})–0?3–([0-2]?\d|30|31)(?=\s*[\|\}])/gi, '$1March $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})–0?4–([0-2]?\d|30|31)(?=\s*[\|\}])/gi, '$1April $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})–0?5–([0-2]?\d|30|31)(?=\s*[\|\}])/gi, '$1May $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})–0?6–([0-2]?\d|30|31)(?=\s*[\|\}])/gi, '$1June $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})–0?7–([0-2]?\d|30|31)(?=\s*[\|\}])/gi, '$1July $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})–0?8–([0-2]?\d|30|31)(?=\s*[\|\}])/gi, '$1August $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})–0?9–([0-2]?\d|30|31)(?=\s*[\|\}])/gi, '$1September $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})–10–([0-2]?\d|30|31)(?=\s*[\|\}])/gi, '$1October $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})–11–([0-2]?\d|30|31)(?=\s*[\|\}])/gi, '$1November $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})–12–([0-2]?\d|30|31)(?=\s*[\|\}])/gi, '$1December $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})[\-–]0?1[\-–]([1-9])(?=\s*[\|\}])/gi, '$1January $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})[\-–]0?2[\-–]([1-9])(?=\s*[\|\}])/gi, '$1February $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})[\-–]0?3[\-–]([1-9])(?=\s*[\|\}])/gi, '$1March $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})[\-–]0?4[\-–]([1-9])(?=\s*[\|\}])/gi, '$1April $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})[\-–]0?5[\-–]([1-9])(?=\s*[\|\}])/gi, '$1May $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})[\-–]0?6[\-–]([1-9])(?=\s*[\|\}])/gi, '$1June $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})[\-–]0?7[\-–]([1-9])(?=\s*[\|\}])/gi, '$1July $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})[\-–]0?8[\-–]([1-9])(?=\s*[\|\}])/gi, '$1August $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})[\-–]0?9[\-–]([1-9])(?=\s*[\|\}])/gi, '$1September $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})[\-–]10[\-–]([1-9])(?=\s*[\|\}])/gi, '$1October $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})[\-–]11[\-–]([1-9])(?=\s*[\|\}])/gi, '$1November $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})[\-–]12[\-–]([1-9])(?=\s*[\|\}])/gi, '$1December $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})[\-–]1[\-–]([0-2]?\d|30|31)(?=\s*[\|\}])/gi, '$1January $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})[\-–]2[\-–](0?[1-9]|[1-2]\d)(?=\s*[\|\}])/gi, '$1February $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})[\-–]3[\-–]([0-2]?\d|30|31)(?=\s*[\|\}])/gi, '$1March $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})[\-–]4[\-–]([0-2]?\d|30|31)(?=\s*[\|\}])/gi, '$1April $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})[\-–]5[\-–]([0-2]?\d|30|31)(?=\s*[\|\}])/gi, '$1May $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})[\-–]6[\-–]([0-2]?\d|30|31)(?=\s*[\|\}])/gi, '$1June $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})[\-–]7[\-–]([0-2]?\d|30|31)(?=\s*[\|\}])/gi, '$1July $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})[\-–]8[\-–]([0-2]?\d|30|31)(?=\s*[\|\}])/gi, '$1August $3, $2');
regex(/(\s*=\s*)([1-2]\d{3})[\-–]9[\-–]([0-2]?\d|30|31)(?=\s*[\|\}])/gi, '$1September $3, $2');
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]10[\-–]([0-2]?\d|30|31)(?=\s*[\|\}])/gi, '$1October $3, $2');
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]11[\-–]([0-2]?\d|30|31)(?=\s*[\|\}])/gi, '$1November $3, $2');
//ArticleText=Regex.Replace(ArticleText, @"(?i)(\s*=\s*)([1-2]\d{3})[\-–]12[\-–]([0-2]?\d|30|31)(?=\s*[\|\}])/gi, '$1December $3, $2');
//yyyymmdd_to_dmy
regex(/(\|[ ]*(?:access|archive|)date[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?1-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1January $3, $2');
regex(/(\|[ ]*(?:access|archive|)date[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?2-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1February $3, $2');
regex(/(\|[ ]*(?:access|archive|)date[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?3-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1March $3, $2');
regex(/(\|[ ]*(?:access|archive|)date[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?4-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1April $3, $2');
regex(/(\|[ ]*(?:access|archive|)date[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?5-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1May $3, $2');
regex(/(\|[ ]*(?:access|archive|)date[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?6-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1June $3, $2');
regex(/(\|[ ]*(?:access|archive|)date[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?7-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1July $3, $2');
regex(/(\|[ ]*(?:access|archive|)date[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?8-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1August $3, $2');
regex(/(\|[ ]*(?:access|archive|)date[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?9-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1September $3, $2');
regex(/(\|[ ]*(?:access|archive|)date[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)10-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1October $3, $2');
regex(/(\|[ ]*(?:access|archive|)date[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)11-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1November $3, $2');
regex(/(\|[ ]*(?:access|archive|)date[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)12-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1December $3, $2');
regex(/(date[ ]*=[ ]*)(0[1-9]|[1-2][0-9]|30|31)-0?1-([1-2][0-9]{3})?/gi, '$1January $2, $3');
regex(/(date[ ]*=[ ]*)(0[1-9]|[1-2][0-9])-0?2-([1-2][0-9]{3})?/gi, '$1February $2, $3');
regex(/(date[ ]*=[ ]*)(0[1-9]|[1-2][0-9]|30|31)-0?3-([1-2][0-9]{3})?/gi, '$1March $2, $3');
regex(/(date[ ]*=[ ]*)(0[1-9]|[1-2][0-9]|30|31)-0?4-([1-2][0-9]{3})?/gi, '$1April $2, $3');
regex(/(date[ ]*=[ ]*)(0[1-9]|[1-2][0-9]|30|31)-0?5-([1-2][0-9]{3})?/gi, '$1May $2, $3');
regex(/(date[ ]*=[ ]*)(0[1-9]|[1-2][0-9]|30|31)-0?6-([1-2][0-9]{3})?/gi, '$1June $2, $3');
regex(/(date[ ]*=[ ]*)(0[1-9]|[1-2][0-9]|30|31)-0?7-([1-2][0-9]{3})?/gi, '$1July $2, $3');
regex(/(date[ ]*=[ ]*)(0[1-9]|[1-2][0-9]|30|31)-0?8-([1-2][0-9]{3})?/gi, '$1August $2, $3');
regex(/(date[ ]*=[ ]*)(0[1-9]|[1-2][0-9]|30|31)-0?9-([1-2][0-9]{3})?/gi, '$1September $2, $3');
regex(/(date[ ]*=[ ]*)(0[1-9]|[1-2][0-9]|30|31)-10-([1-2][0-9]{3})?/gi, '$1October $2, $3');
regex(/(date[ ]*=[ ]*)(0[1-9]|[1-2][0-9]|30|31)-11-([1-2][0-9]{3})?/gi, '$1November $2, $3');
regex(/(date[ ]*=[ ]*)(0[1-9]|[1-2][0-9]|30|31)-12-([1-2][0-9]{3})?/gi, '$1December $2, $3');
regex(/(date[ ]*=[ ]*)([1-2][0-9]{3}) (January )(0[1-9]|[1-2][0-9]|30|31)/gi, '$1$3$4, $2');
regex(/(date[ ]*=[ ]*)([1-2][0-9]{3}) (February )(0[1-9]|[1-2][0-9])/gi, '$1$3$4, $2');
regex(/(date[ ]*=[ ]*)([1-2][0-9]{3}) (March )(0[1-9]|[1-2][0-9]|30|31)/gi, '$1$3$4, $2');
regex(/(date[ ]*=[ ]*)([1-2][0-9]{3}) (April )(0[1-9]|[1-2][0-9]|30|31)/gi, '$1$3$4, $2');
regex(/(date[ ]*=[ ]*)([1-2][0-9]{3}) (May )(0[1-9]|[1-2][0-9]|30|31)/gi, '$1$3$4, $2');
regex(/(date[ ]*=[ ]*)([1-2][0-9]{3}) (June )(0[1-9]|[1-2][0-9]|30|31)/gi, '$1$3$4, $2');
regex(/(date[ ]*=[ ]*)([1-2][0-9]{3}) (July )(0[1-9]|[1-2][0-9]|30|31)/gi, '$1$3$4, $2');
regex(/(date[ ]*=[ ]*)([1-2][0-9]{3}) (August )(0[1-9]|[1-2][0-9]|30|31)/gi, '$1$3$4, $2');
regex(/(date[ ]*=[ ]*)([1-2][0-9]{3}) (September )(0[1-9]|[1-2][0-9]|30|31)/gi, '$1$3$4, $2');
regex(/(date[ ]*=[ ]*)([1-2][0-9]{3}) (October )(0[1-9]|[1-2][0-9]|30|31)/gi, '$1$3$4, $2');
regex(/(date[ ]*=[ ]*)([1-2][0-9]{3}) (November )(0[1-9]|[1-2][0-9]|30|31)/gi, '$1$3$4, $2');
regex(/(date[ ]*=[ ]*)([1-2][0-9]{3}) (December )(0[1-9]|[1-2][0-9]|30|31)/gi, '$1$3$4, $2');
regex(/([^\d\w\/\-%,])([12]\d{3}-\d\d-\d\d)(<\s?\/ref.*?>)/gi, '$1$2 $3');
//code to convert ref ISO-dates outside citation templates
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-01-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2January $4, $3$5$6');
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-02-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2February $4, $3$5$6');
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-03-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2March $4, $3$5$6');
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-04-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2April $4, $3$5$6');
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-05-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2May $4, $3$5$6');
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-06-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2June $4, $3$5$6');
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-07-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2July $4, $3$5$6');
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-08-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2August $4, $3$5$6');
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-09-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2September $4, $3$5$6');
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-10-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2October $4, $3$5$6');
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-11-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2November $4, $3$5$6');
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-12-0(\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2December $4, $3$5$6');
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-01-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2January $4, $3$5$6');
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-02-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2February $4, $3$5$6');
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-03-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2March $4, $3$5$6');
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-04-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2April $4, $3$5$6');
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-05-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2May $4, $3$5$6');
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-06-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2June $4, $3$5$6');
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-07-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2July $4, $3$5$6');
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-08-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2August $4, $3$5$6');
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-09-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2September $4, $3$5$6');
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-10-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2October $4, $3$5$6');
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-11-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2November $4, $3$5$6');
regex(/(<ref.*?>[^<]+?)(\s\()([12]\d{3})-12-([1-3]\d)(\)[^\w\/\-%,])([^<]*?<\s?\/ref.*?>)/gi, '$1$2December $4, $3$5$6');
}
addOnloadHook(function () {
if(document.forms.editform) {
mw.util.addPortletLink('p-tb', 'javascript:Ohc_AWB_mdy_test()', 'AWB to mdy', 't-addmetric', 'AWB to mdy', '', '');
}
});
// </nowiki>