// <nowiki>
//NOTE TO SELF: Date parameters in {{dmy/mdy}} template need updating at the start of each month
// This script aligns dates into one of two formats allowed by [[WP:MOSNUM]].
//<nowiki>
// PLEASE READ THE DOCUMENTATION at [[User:Ohconfucius/MOSNUM dates]] (click on the link above) before using.
// Feedback and constructive criticism are welcome
importScript("User:Ohconfucius/formatgeneral.js");
function Ohc_unambiguous_dates(){
var txt=document.editform.wpTextbox1;
// resolvable ambiguous date formats
//4-digit year universal
txt.value=txt.value.replace(/([^\d])\s0?1\/0?1\/([12]\d{3})(?![\w\d-])/g, '$1 1 January $2');
txt.value=txt.value.replace(/([^\d])\s0?2\/0?2\/([12]\d{3})(?![\w\d-])/g, '$1 2 February $2');
txt.value=txt.value.replace(/([^\d])\s0?3\/0?3\/([12]\d{3})(?![\w\d-])/g, '$1 3 March $2');
txt.value=txt.value.replace(/([^\d])\s0?4\/0?4\/([12]\d{3})(?![\w\d-])/g, '$1 4 April $2');
txt.value=txt.value.replace(/([^\d])\s0?5\/0?5\/([12]\d{3})(?![\w\d-])/g, '$1 5 May $2');
txt.value=txt.value.replace(/([^\d])\s0?6\/0?6\/([12]\d{3})(?![\w\d-])/g, '$1 6 June $2');
txt.value=txt.value.replace(/([^\d])\s0?7\/0?7\/([12]\d{3})(?![\w\d-])/g, '$1 7 July $2');
txt.value=txt.value.replace(/([^\d])\s0?8\/0?8\/([12]\d{3})(?![\w\d-])/g, '$1 8 August $2');
txt.value=txt.value.replace(/([^\d])\s0?9\/0?9\/([12]\d{3})(?![\w\d-])/g, '$1 9 September $2');
txt.value=txt.value.replace(/([^\d])\s10\/10\/([12]\d{3})(?![\w\d-])/g, '$1 10 October $2');
txt.value=txt.value.replace(/([^\d])\s11\/11\/([12]\d{3})(?![\w\d-])/g, '$1 11 November $2');
txt.value=txt.value.replace(/([^\d])\s12\/12\/([12]\d{3})(?![\w\d-])/g, '$1 12 December $2');
//4-digit year UK style
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?1\/([12]\d{3})(?![\w\d-])/g, '$1 January $2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?2\/([12]\d{3})(?![\w\d-])/g, '$1 February $2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?3\/([12]\d{3})(?![\w\d-])/g, '$1 March $2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?4\/([12]\d{3})(?![\w\d-])/g, '$1 April $2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?5\/([12]\d{3})(?![\w\d-])/g, '$1 May $2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?6\/([12]\d{3})(?![\w\d-])/g, '$1 June $2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?7\/([12]\d{3})(?![\w\d-])/g, '$1 July $2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?8\/([12]\d{3})(?![\w\d-])/g, '$1 August $2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?9\/([12]\d{3})(?![\w\d-])/g, '$1 September $2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/10\/([12]\d{3})(?![\w\d-])/g, '$1 October $2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/11\/([12]\d{3})(?![\w\d-])/g, '$1 November $2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/12\/([12]\d{3})(?![\w\d-])/g, '$1 December $2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?1\/([12]\d{3})(?![\w\d-])/g, '$1 January $2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?2\/([12]\d{3})(?![\w\d-])/g, '$1 February $2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?3\/([12]\d{3})(?![\w\d-])/g, '$1 March $2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?4\/([12]\d{3})(?![\w\d-])/g, '$1 April $2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?5\/([12]\d{3})(?![\w\d-])/g, '$1 May $2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?6\/([12]\d{3})(?![\w\d-])/g, '$1 June $2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?7\/([12]\d{3})(?![\w\d-])/g, '$1 July $2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?8\/([12]\d{3})(?![\w\d-])/g, '$1 August $2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?9\/([12]\d{3})(?![\w\d-])/g, '$1 September $2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/10\/([12]\d{3})(?![\w\d-])/g, '$1 October $2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/11\/([12]\d{3})(?![\w\d-])/g, '$1 November $2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/12\/([12]\d{3})(?![\w\d-])/g, '$1 December $2');
//4-digit year US style
txt.value=txt.value.replace(/([^\w\d-])0?1\/([23]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 January $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?2\/([23]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 February $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?3\/([23]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 March $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?4\/([23]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 April $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?5\/([23]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 May $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?6\/([23]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 June $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?7\/([23]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 July $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?8\/([23]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 August $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?9\/([23]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 September $2, $3');
txt.value=txt.value.replace(/([^\w\d-])10\/([23]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 October $2, $3');
txt.value=txt.value.replace(/([^\w\d-])11\/([23]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 November $2, $3');
txt.value=txt.value.replace(/([^\w\d-])12\/([23]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 December $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?1\/(1[3-9])\/([12]\d{3})(?![\w\d-])/g, '$1 January $2,\'$3');
txt.value=txt.value.replace(/([^\w\d-])0?2\/(1[3-9])\/([12]\d{3})(?![\w\d-])/g, '$1 February $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?3\/(1[3-9])\/([12]\d{3})(?![\w\d-])/g, '$1 March $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?4\/(1[3-9])\/([12]\d{3})(?![\w\d-])/g, '$1 April $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?5\/(1[3-9])\/([12]\d{3})(?![\w\d-])/g, '$1 May $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?6\/(1[3-9])\/([12]\d{3})(?![\w\d-])/g, '$1 June $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?7\/(1[3-9])\/([12]\d{3})(?![\w\d-])/g, '$1 July $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?8\/(1[3-9])\/([12]\d{3})(?![\w\d-])/g, '$1 August $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?9\/(1[3-9])\/([12]\d{3})(?![\w\d-])/g, '$1 September $2, $3');
txt.value=txt.value.replace(/([^\w\d-])10\/(1[3-9])\/([12]\d{3})(?![\w\d-])/g, '$1 October $2, $3');
txt.value=txt.value.replace(/([^\w\d-])11\/(1[3-9])\/([12]\d{3})(?![\w\d-])/g, '$1 November $2, $3');
txt.value=txt.value.replace(/([^\w\d-])12\/(1[3-9])\/([12]\d{3})(?![\w\d-])/g, '$1 December $2, $3');
//2-digit year ('00-'19) universal
txt.value=txt.value.replace(/([^\d])\s0?1\/0?1\/([01]\d)(?![\w\d-])/g, '$1 1 January 20$2');
txt.value=txt.value.replace(/([^\d])\s0?2\/0?2\/([01]\d)(?![\w\d-])/g, '$1 2 February 20$2');
txt.value=txt.value.replace(/([^\d])\s0?3\/0?3\/([01]\d)(?![\w\d-])/g, '$1 3 March 20$2');
txt.value=txt.value.replace(/([^\d])\s0?4\/0?4\/([01]\d)(?![\w\d-])/g, '$1 4 April 20$2');
txt.value=txt.value.replace(/([^\d])\s0?5\/0?5\/([01]\d)(?![\w\d-])/g, '$1 5 May 20$2');
txt.value=txt.value.replace(/([^\d])\s0?6\/0?6\/([01]\d)(?![\w\d-])/g, '$1 6 June 20$2');
txt.value=txt.value.replace(/([^\d])\s0?7\/0?7\/([01]\d)(?![\w\d-])/g, '$1 7 July 20$2');
txt.value=txt.value.replace(/([^\d])\s0?8\/0?8\/([01]\d)(?![\w\d-])/g, '$1 8 August 20$2');
txt.value=txt.value.replace(/([^\d])\s0?9\/0?9\/([01]\d)(?![\w\d-])/g, '$1 9 September 20$2');
txt.value=txt.value.replace(/([^\d])\s10\/10\/([01]\d)(?![\w\d-])/g, '$1 10 October 20$2');
txt.value=txt.value.replace(/([^\d])\s11\/11\/([01]\d)(?![\w\d-])/g, '$1 11 November 20$2');
txt.value=txt.value.replace(/([^\d])\s12\/12\/([01]\d)(?![\w\d-])/g, '$1 12 December 20$2');
//2-digit year ('00-'19) UK style
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?1\/([01]\d)(?![\w\d-])/g, '$1 January 20$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?2\/([01]\d)(?![\w\d-])/g, '$1 February 20$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?3\/([01]\d)(?![\w\d-])/g, '$1 March 20$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?4\/([01]\d)(?![\w\d-])/g, '$1 April 20$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?5\/([01]\d)(?![\w\d-])/g, '$1 May 20$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?6\/([01]\d)(?![\w\d-])/g, '$1 June 20$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?7\/([01]\d)(?![\w\d-])/g, '$1 July 20$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?8\/([01]\d)(?![\w\d-])/g, '$1 August 20$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?9\/([01]\d)(?![\w\d-])/g, '$1 September 20$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/10\/([01]\d)(?![\w\d-])/g, '$1 October 20$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/11\/([01]\d)(?![\w\d-])/g, '$1 November 20$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/12\/([01]\d)(?![\w\d-])/g, '$1 December 20$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?1\/([01]\d)(?![\w\d-])/g, '$1 January 20$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?2\/([01]\d)(?![\w\d-])/g, '$1 February 20$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?3\/([01]\d)(?![\w\d-])/g, '$1 March 20$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?4\/([01]\d)(?![\w\d-])/g, '$1 April 20$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?5\/([01]\d)(?![\w\d-])/g, '$1 May 20$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?6\/([01]\d)(?![\w\d-])/g, '$1 June 20$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?7\/([01]\d)(?![\w\d-])/g, '$1 July 20$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?8\/([01]\d)(?![\w\d-])/g, '$1 August 20$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?9\/([01]\d)(?![\w\d-])/g, '$1 September 20$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/10\/([01]\d)(?![\w\d-])/g, '$1 October 20$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/11\/([01]\d)(?![\w\d-])/g, '$1 November 20$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/12\/([01]\d)(?![\w\d-])/g, '$1 December 20$2');
//2-digit year ('00-'19) US style
txt.value=txt.value.replace(/([^\w\d-])0?1\/([23]\d)\/([01]\d)(?![\w\d-])/g, '$1 January $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?2\/([23]\d)\/([01]\d)(?![\w\d-])/g, '$1 February $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?3\/([23]\d)\/([01]\d)(?![\w\d-])/g, '$1 March $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?4\/([23]\d)\/([01]\d)(?![\w\d-])/g, '$1 April $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?5\/([23]\d)\/([01]\d)(?![\w\d-])/g, '$1 May $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?6\/([23]\d)\/([01]\d)(?![\w\d-])/g, '$1 June $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?7\/([23]\d)\/([01]\d)(?![\w\d-])/g, '$1 July $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?8\/([23]\d)\/([01]\d)(?![\w\d-])/g, '$1 August $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?9\/([23]\d)\/([01]\d)(?![\w\d-])/g, '$1 September $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])10\/([23]\d)\/([01]\d)(?![\w\d-])/g, '$1 October $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])11\/([23]\d)\/([01]\d)(?![\w\d-])/g, '$1 November $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])12\/([23]\d)\/([01]\d)(?![\w\d-])/g, '$1 December $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?1\/(1[3-9])\/([01]\d)(?![\w\d-])/g, '$1 January $2,20$3');
txt.value=txt.value.replace(/([^\w\d-])0?2\/(1[3-9])\/([01]\d)(?![\w\d-])/g, '$1 February $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?3\/(1[3-9])\/([01]\d)(?![\w\d-])/g, '$1 March $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?4\/(1[3-9])\/([01]\d)(?![\w\d-])/g, '$1 April $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?5\/(1[3-9])\/([01]\d)(?![\w\d-])/g, '$1 May $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?6\/(1[3-9])\/([01]\d)(?![\w\d-])/g, '$1 June $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?7\/(1[3-9])\/([01]\d)(?![\w\d-])/g, '$1 July $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?8\/(1[3-9])\/([01]\d)(?![\w\d-])/g, '$1 August $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?9\/(1[3-9])\/([01]\d)(?![\w\d-])/g, '$1 September $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])10\/(1[3-9])\/([01]\d)(?![\w\d-])/g, '$1 October $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])11\/(1[3-9])\/([01]\d)(?![\w\d-])/g, '$1 November $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])12\/(1[3-9])\/([01]\d)(?![\w\d-])/g, '$1 December $2, 20$3');
//2-digit year ('50-'99) universal
txt.value=txt.value.replace(/([^\d])\s0?1\/0?1\/([5-9]\d)(?![\w\d-])/g, '$1 1 January 19$2');
txt.value=txt.value.replace(/([^\d])\s0?2\/0?2\/([5-9]\d)(?![\w\d-])/g, '$1 2 February 19$2');
txt.value=txt.value.replace(/([^\d])\s0?3\/0?3\/([5-9]\d)(?![\w\d-])/g, '$1 3 March 19$2');
txt.value=txt.value.replace(/([^\d])\s0?4\/0?4\/([5-9]\d)(?![\w\d-])/g, '$1 4 April 19$2');
txt.value=txt.value.replace(/([^\d])\s0?5\/0?5\/([5-9]\d)(?![\w\d-])/g, '$1 5 May 19$2');
txt.value=txt.value.replace(/([^\d])\s0?6\/0?6\/([5-9]\d)(?![\w\d-])/g, '$1 6 June 19$2');
txt.value=txt.value.replace(/([^\d])\s0?7\/0?7\/([5-9]\d)(?![\w\d-])/g, '$1 7 July 19$2');
txt.value=txt.value.replace(/([^\d])\s0?8\/0?8\/([5-9]\d)(?![\w\d-])/g, '$1 8 August 19$2');
txt.value=txt.value.replace(/([^\d])\s0?9\/0?9\/([5-9]\d)(?![\w\d-])/g, '$1 9 September 19$2');
txt.value=txt.value.replace(/([^\d])\s10\/10\/([5-9]\d)(?![\w\d-])/g, '$1 10 October 19$2');
txt.value=txt.value.replace(/([^\d])\s11\/11\/([5-9]\d)(?![\w\d-])/g, '$1 11 November 19$2');
txt.value=txt.value.replace(/([^\d])\s12\/12\/([5-9]\d)(?![\w\d-])/g, '$1 12 December 19$2');
//2-digit year ('50-'99) UK style
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?1\/([5-9]\d)(?![\w\d-])/g, '$1 January 19$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?2\/([5-9]\d)(?![\w\d-])/g, '$1 February 19$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?3\/([5-9]\d)(?![\w\d-])/g, '$1 March 19$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?4\/([5-9]\d)(?![\w\d-])/g, '$1 April 19$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?5\/([5-9]\d)(?![\w\d-])/g, '$1 May 19$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?6\/([5-9]\d)(?![\w\d-])/g, '$1 June 19$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?7\/([5-9]\d)(?![\w\d-])/g, '$1 July 19$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?8\/([5-9]\d)(?![\w\d-])/g, '$1 August 19$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?9\/([5-9]\d)(?![\w\d-])/g, '$1 September 19$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/10\/([5-9]\d)(?![\w\d-])/g, '$1 October 19$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/11\/([5-9]\d)(?![\w\d-])/g, '$1 November 19$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/12\/([5-9]\d)(?![\w\d-])/g, '$1 December 19$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?1\/([5-9]\d)(?![\w\d-])/g, '$1 January 19$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?2\/([5-9]\d)(?![\w\d-])/g, '$1 February 19$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?3\/([5-9]\d)(?![\w\d-])/g, '$1 March 19$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?4\/([5-9]\d)(?![\w\d-])/g, '$1 April 19$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?5\/([5-9]\d)(?![\w\d-])/g, '$1 May 19$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?6\/([5-9]\d)(?![\w\d-])/g, '$1 June 19$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?7\/([5-9]\d)(?![\w\d-])/g, '$1 July 19$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?8\/([5-9]\d)(?![\w\d-])/g, '$1 August 19$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?9\/([5-9]\d)(?![\w\d-])/g, '$1 September 19$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/10\/([5-9]\d)(?![\w\d-])/g, '$1 October 19$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/11\/([5-9]\d)(?![\w\d-])/g, '$1 November 19$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/12\/([5-9]\d)(?![\w\d-])/g, '$1 December 19$2');
//2-digit year ('50-'99) US style
txt.value=txt.value.replace(/([^\w\d-])0?1\/([23]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 January $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?2\/([23]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 February $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?3\/([23]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 March $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?4\/([23]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 April $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?5\/([23]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 May $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?6\/([23]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 June $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?7\/([23]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 July $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?8\/([23]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 August $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?9\/([23]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 September $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])10\/([23]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 October $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])11\/([23]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 November $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])12\/([23]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 December $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?1\/(1[3-9])\/([5-9]\d)(?![\w\d-])/g, '$1 January $2,19$3');
txt.value=txt.value.replace(/([^\w\d-])0?2\/(1[3-9])\/([5-9]\d)(?![\w\d-])/g, '$1 February $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?3\/(1[3-9])\/([5-9]\d)(?![\w\d-])/g, '$1 March $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?4\/(1[3-9])\/([5-9]\d)(?![\w\d-])/g, '$1 April $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?5\/(1[3-9])\/([5-9]\d)(?![\w\d-])/g, '$1 May $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?6\/(1[3-9])\/([5-9]\d)(?![\w\d-])/g, '$1 June $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?7\/(1[3-9])\/([5-9]\d)(?![\w\d-])/g, '$1 July $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?8\/(1[3-9])\/([5-9]\d)(?![\w\d-])/g, '$1 August $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?9\/(1[3-9])\/([5-9]\d)(?![\w\d-])/g, '$1 September $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])10\/(1[3-9])\/([5-9]\d)(?![\w\d-])/g, '$1 October $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])11\/(1[3-9])\/([5-9]\d)(?![\w\d-])/g, '$1 November $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])12\/(1[3-9])\/([5-9]\d)(?![\w\d-])/g, '$1 December $2, 19$3');
//universal 2-digit year
txt.value=txt.value.replace(/([^\d])\s0?1\/0?1\/(\d{2})(?![\w\d-])/g, '$1 1 January \'$2');
txt.value=txt.value.replace(/([^\d])\s0?2\/0?2\/(\d{2})(?![\w\d-])/g, '$1 2 February \'$2');
txt.value=txt.value.replace(/([^\d])\s0?3\/0?3\/(\d{2})(?![\w\d-])/g, '$1 3 March \'$2');
txt.value=txt.value.replace(/([^\d])\s0?4\/0?4\/(\d{2})(?![\w\d-])/g, '$1 4 April \'$2');
txt.value=txt.value.replace(/([^\d])\s0?5\/0?5\/(\d{2})(?![\w\d-])/g, '$1 5 May \'$2');
txt.value=txt.value.replace(/([^\d])\s0?6\/0?6\/(\d{2})(?![\w\d-])/g, '$1 6 June \'$2');
txt.value=txt.value.replace(/([^\d])\s0?7\/0?7\/(\d{2})(?![\w\d-])/g, '$1 7 July \'$2');
txt.value=txt.value.replace(/([^\d])\s0?8\/0?8\/(\d{2})(?![\w\d-])/g, '$1 8 August \'$2');
txt.value=txt.value.replace(/([^\d])\s0?9\/0?9\/(\d{2})(?![\w\d-])/g, '$1 9 September \'$2');
txt.value=txt.value.replace(/([^\d])\s10\/10\/(\d{2})(?![\w\d-])/g, '$1 10 October \'$2');
txt.value=txt.value.replace(/([^\d])\s11\/11\/(\d{2})(?![\w\d-])/g, '$1 11 November \'$2');
txt.value=txt.value.replace(/([^\d])\s12\/12\/(\d{2})(?![\w\d-])/g, '$1 12 December \'$2');
//UK style
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?1\/(\d{2})(?![\w\d-])/g, '$1 January \'$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?2\/(\d{2})(?![\w\d-])/g, '$1 February \'$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?3\/(\d{2})(?![\w\d-])/g, '$1 March \'$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?4\/(\d{2})(?![\w\d-])/g, '$1 April \'$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?5\/(\d{2})(?![\w\d-])/g, '$1 May \'$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?6\/(\d{2})(?![\w\d-])/g, '$1 June \'$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?7\/(\d{2})(?![\w\d-])/g, '$1 July \'$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?8\/(\d{2})(?![\w\d-])/g, '$1 August \'$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/0?9\/(\d{2})(?![\w\d-])/g, '$1 September \'$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/10\/(\d{2})(?![\w\d-])/g, '$1 October \'$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/11\/(\d{2})(?![\w\d-])/g, '$1 November \'$2');
txt.value=txt.value.replace(/([^\w\d-][23]\d)\/12\/(\d{2})(?![\w\d-])/g, '$1 December \'$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?1\/(\d{2})(?![\w\d-])/g, '$1 January \'$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?2\/(\d{2})(?![\w\d-])/g, '$1 February \'$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?3\/(\d{2})(?![\w\d-])/g, '$1 March \'$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?4\/(\d{2})(?![\w\d-])/g, '$1 April \'$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?5\/(\d{2})(?![\w\d-])/g, '$1 May \'$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?6\/(\d{2})(?![\w\d-])/g, '$1 June \'$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?7\/(\d{2})(?![\w\d-])/g, '$1 July \'$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?8\/(\d{2})(?![\w\d-])/g, '$1 August \'$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/0?9\/(\d{2})(?![\w\d-])/g, '$1 September \'$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/10\/(\d{2})(?![\w\d-])/g, '$1 October \'$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/11\/(\d{2})(?![\w\d-])/g, '$1 November \'$2');
txt.value=txt.value.replace(/([^\w\d-]1[3-9])\/12\/(\d{2})(?![\w\d-])/g, '$1 December \'$2');
//US style
txt.value=txt.value.replace(/([^\w\d-])0?1\/([23]\d)\/(\d{2})(?![\w\d-])/g, '$1 January $2, \'$3');
txt.value=txt.value.replace(/([^\w\d-])0?2\/([23]\d)\/(\d{2})(?![\w\d-])/g, '$1 February $2, \'$3');
txt.value=txt.value.replace(/([^\w\d-])0?3\/([23]\d)\/(\d{2})(?![\w\d-])/g, '$1 March $2, \'$3');
txt.value=txt.value.replace(/([^\w\d-])0?4\/([23]\d)\/(\d{2})(?![\w\d-])/g, '$1 April $2, \'$3');
txt.value=txt.value.replace(/([^\w\d-])0?5\/([23]\d)\/(\d{2})(?![\w\d-])/g, '$1 May $2, \'$3');
txt.value=txt.value.replace(/([^\w\d-])0?6\/([23]\d)\/(\d{2})(?![\w\d-])/g, '$1 June $2, \'$3');
txt.value=txt.value.replace(/([^\w\d-])0?7\/([23]\d)\/(\d{2})(?![\w\d-])/g, '$1 July $2, \'$3');
txt.value=txt.value.replace(/([^\w\d-])0?8\/([23]\d)\/(\d{2})(?![\w\d-])/g, '$1 August $2, \'$3');
txt.value=txt.value.replace(/([^\w\d-])0?9\/([23]\d)\/(\d{2})(?![\w\d-])/g, '$1 September $2, \'$3');
txt.value=txt.value.replace(/([^\w\d-])10\/([23]\d)\/(\d{2})(?![\w\d-])/g, '$1 October $2, \'$3');
txt.value=txt.value.replace(/([^\w\d-])11\/([23]\d)\/(\d{2})(?![\w\d-])/g, '$1 November $2, \'$3');
txt.value=txt.value.replace(/([^\w\d-])12\/([23]\d)\/(\d{2})(?![\w\d-])/g, '$1 December $2, \'$3');
txt.value=txt.value.replace(/([^\w\d-])0?1\/(1[3-9])\/(\d{2})(?![\w\d-])/g, '$1 January $2,\'$3');
txt.value=txt.value.replace(/([^\w\d-])0?2\/(1[3-9])\/(\d{2})(?![\w\d-])/g, '$1 February $2, \'$3');
txt.value=txt.value.replace(/([^\w\d-])0?3\/(1[3-9])\/(\d{2})(?![\w\d-])/g, '$1 March $2, \'$3');
txt.value=txt.value.replace(/([^\w\d-])0?4\/(1[3-9])\/(\d{2})(?![\w\d-])/g, '$1 April $2, \'$3');
txt.value=txt.value.replace(/([^\w\d-])0?5\/(1[3-9])\/(\d{2})(?![\w\d-])/g, '$1 May $2, \'$3');
txt.value=txt.value.replace(/([^\w\d-])0?6\/(1[3-9])\/(\d{2})(?![\w\d-])/g, '$1 June $2, \'$3');
txt.value=txt.value.replace(/([^\w\d-])0?7\/(1[3-9])\/(\d{2})(?![\w\d-])/g, '$1 July $2, \'$3');
txt.value=txt.value.replace(/([^\w\d-])0?8\/(1[3-9])\/(\d{2})(?![\w\d-])/g, '$1 August $2, \'$3');
txt.value=txt.value.replace(/([^\w\d-])0?9\/(1[3-9])\/(\d{2})(?![\w\d-])/g, '$1 September $2, \'$3');
txt.value=txt.value.replace(/([^\w\d-])10\/(1[3-9])\/(\d{2})(?![\w\d-])/g, '$1 October $2, \'$3');
txt.value=txt.value.replace(/([^\w\d-])11\/(1[3-9])\/(\d{2})(?![\w\d-])/g, '$1 November $2, \'$3');
txt.value=txt.value.replace(/([^\w\d-])12\/(1[3-9])\/(\d{2})(?![\w\d-])/g, '$1 December $2, \'$3');
// Add a tag to the summary box
var txt=document.editform.wpSummary;
var summary = "resolved [[WP:MOSNUM|ambiguous date formats]]";
if (txt.value.indexOf(summary) == -1) {
if (txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) {
txt.value += " | ";
}
txt.value += summary;
}
document.forms.editform.wpMinoredit.checked = true;
// document.editform.wpDiff.click();
}
//////
function Ohc_US_slash_dates(){
var txt=document.editform.wpTextbox1;
// resolvable ambiguous date formats
//4-digit year US style
txt.value=txt.value.replace(/([^\w\d-])0?1\/([0-3]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 January $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?2\/([0-3]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 February $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?3\/([0-3]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 March $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?4\/([0-3]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 April $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?5\/([0-3]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 May $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?6\/([0-3]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 June $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?7\/([0-3]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 July $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?8\/([0-3]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 August $2, $3');
txt.value=txt.value.replace(/([^\w\d-])0?9\/([0-3]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 September $2, $3');
txt.value=txt.value.replace(/([^\w\d-])10\/([0-3]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 October $2, $3');
txt.value=txt.value.replace(/([^\w\d-])11\/([0-3]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 November $2, $3');
txt.value=txt.value.replace(/([^\w\d-])12\/([0-3]\d)\/([12]\d{3})(?![\w\d-])/g, '$1 December $2, $3');
//2-digit year ('00-'19) US style
txt.value=txt.value.replace(/([^\w\d-])0?1\/([0-3]\d)\/([01]\d)(?![\w\d-])/g, '$1 January $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?2\/([0-3]\d)\/([01]\d)(?![\w\d-])/g, '$1 February $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?3\/([0-3]\d)\/([01]\d)(?![\w\d-])/g, '$1 March $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?4\/([0-3]\d)\/([01]\d)(?![\w\d-])/g, '$1 April $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?5\/([0-3]\d)\/([01]\d)(?![\w\d-])/g, '$1 May $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?6\/([0-3]\d)\/([01]\d)(?![\w\d-])/g, '$1 June $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?7\/([0-3]\d)\/([01]\d)(?![\w\d-])/g, '$1 July $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?8\/([0-3]\d)\/([01]\d)(?![\w\d-])/g, '$1 August $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])0?9\/([0-3]\d)\/([01]\d)(?![\w\d-])/g, '$1 September $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])10\/([0-3]\d)\/([01]\d)(?![\w\d-])/g, '$1 October $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])11\/([0-3]\d)\/([01]\d)(?![\w\d-])/g, '$1 November $2, 20$3');
txt.value=txt.value.replace(/([^\w\d-])12\/([0-3]\d)\/([01]\d)(?![\w\d-])/g, '$1 December $2, 20$3');
//2-digit year ('50-'99) US style
txt.value=txt.value.replace(/([^\w\d-])0?1\/([0-3]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 January $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?2\/([0-3]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 February $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?3\/([0-3]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 March $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?4\/([0-3]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 April $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?5\/([0-3]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 May $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?6\/([0-3]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 June $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?7\/([0-3]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 July $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?8\/([0-3]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 August $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])0?9\/([0-3]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 September $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])10\/([0-3]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 October $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])11\/([0-3]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 November $2, 19$3');
txt.value=txt.value.replace(/([^\w\d-])12\/([0-3]\d)\/([5-9]\d)(?![\w\d-])/g, '$1 December $2, 19$3');
//removing leading zeroes
txt.value=txt.value.replace(/([^\d][^\w\d])(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s0(\d),?\s([12]\d{3})([^\w\d][^\d]|\b)/gi, '$1$2 $3, $4$5');
txt.value=txt.value.replace(/([^\d][^\w\d])(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s0(\d)([^\w\d][^\d]|\b)/gi, '$1$2 $3$4');
// Add a tag to the summary box
var txt=document.editform.wpSummary;
var summary = "resolved [[WP:MOSNUM|ambiguous date formats]]";
if (txt.value.indexOf(summary) == -1) {
if (txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) {
txt.value += " | ";
}
txt.value += summary;
}
document.forms.editform.wpMinoredit.checked = true;
// document.editform.wpDiff.click();
}
function Ohc_UK_slash_dates(){
var txt=document.editform.wpTextbox1;
// resolvable ambiguous date formats
//4-digit year UK style
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?1\/([12]\d{3})(?![\w\d-])/g, '$1 January $2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?2\/([12]\d{3})(?![\w\d-])/g, '$1 February $2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?3\/([12]\d{3})(?![\w\d-])/g, '$1 March $2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?4\/([12]\d{3})(?![\w\d-])/g, '$1 April $2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?5\/([12]\d{3})(?![\w\d-])/g, '$1 May $2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?6\/([12]\d{3})(?![\w\d-])/g, '$1 June $2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?7\/([12]\d{3})(?![\w\d-])/g, '$1 July $2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?8\/([12]\d{3})(?![\w\d-])/g, '$1 August $2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?9\/([12]\d{3})(?![\w\d-])/g, '$1 September $2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/10\/([12]\d{3})(?![\w\d-])/g, '$1 October $2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/11\/([12]\d{3})(?![\w\d-])/g, '$1 November $2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/12\/([12]\d{3})(?![\w\d-])/g, '$1 December $2');
//2-digit year ('00-'19) UK style
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?1\/([01]\d)(?![\w\d-])/g, '$1 January 20$2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?2\/([01]\d)(?![\w\d-])/g, '$1 February 20$2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?3\/([01]\d)(?![\w\d-])/g, '$1 March 20$2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?4\/([01]\d)(?![\w\d-])/g, '$1 April 20$2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?5\/([01]\d)(?![\w\d-])/g, '$1 May 20$2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?6\/([01]\d)(?![\w\d-])/g, '$1 June 20$2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?7\/([01]\d)(?![\w\d-])/g, '$1 July 20$2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?8\/([01]\d)(?![\w\d-])/g, '$1 August 20$2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?9\/([01]\d)(?![\w\d-])/g, '$1 September 20$2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/10\/([01]\d)(?![\w\d-])/g, '$1 October 20$2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/11\/([01]\d)(?![\w\d-])/g, '$1 November 20$2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/12\/([01]\d)(?![\w\d-])/g, '$1 December 20$2');
//2-digit year ('50-'99) UK style
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?1\/([5-9]\d)(?![\w\d-])/g, '$1 January 19$2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?2\/([5-9]\d)(?![\w\d-])/g, '$1 February 19$2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?3\/([5-9]\d)(?![\w\d-])/g, '$1 March 19$2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?4\/([5-9]\d)(?![\w\d-])/g, '$1 April 19$2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?5\/([5-9]\d)(?![\w\d-])/g, '$1 May 19$2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?6\/([5-9]\d)(?![\w\d-])/g, '$1 June 19$2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?7\/([5-9]\d)(?![\w\d-])/g, '$1 July 19$2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?8\/([5-9]\d)(?![\w\d-])/g, '$1 August 19$2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/0?9\/([5-9]\d)(?![\w\d-])/g, '$1 September 19$2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/10\/([5-9]\d)(?![\w\d-])/g, '$1 October 19$2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/11\/([5-9]\d)(?![\w\d-])/g, '$1 November 19$2');
txt.value=txt.value.replace(/([^\w\d-][0-3]\d)\/12\/([5-9]\d)(?![\w\d-])/g, '$1 December 19$2');
//removing leading zeroes
txt.value=txt.value.replace(/([^\d][^\w\d])0(\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([12]\d{3})([^\w\d][^\d]|\b)/gi, '$1$2 $3 $4$5');
txt.value=txt.value.replace(/([^\d][^\w\d])0(\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|\.|))([^\w\d][^\d]|\b)/gi, '$1$2 $3$4');
// Add a tag to the summary box
var txt=document.editform.wpSummary;
var summary = "resolved [[WP:MOSNUM|slash-dates]]";
if (txt.value.indexOf(summary) == -1) {
if (txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) {
txt.value += " | ";
}
txt.value += summary;
}
document.forms.editform.wpMinoredit.checked = true;
// document.editform.wpDiff.click();
}
function Ohc_fix_common_errors() {
var txt=document.editform.wpTextbox1;
// capitalise month names
txt.value=txt.value.replace(/(\s)jan(|uary|\.)(\s)/g, '$1Jan$2$3');
txt.value=txt.value.replace(/(\s)feb(|ruary|\.)(\s)/g, '$1Feb$2$3');
txt.value=txt.value.replace(/(\d\s)mar(|ch|\.)(\s)/g, '$1Mar$2$3');
txt.value=txt.value.replace(/(\s)mar(|ch|\.)(\s\d)/g, '$1Mar$2$3');
txt.value=txt.value.replace(/(\s)apr(|il|\.)(\s)/g, '$1Apr$2$3');
txt.value=txt.value.replace(/(\d\s)may(,|\.)(\s)/g, '$1May$2$3');
txt.value=txt.value.replace(/(\s)may(|\.)(\s\d)/g, '$1May$2$3');
txt.value=txt.value.replace(/(\s)jun(|e|\.)(\s)/g, '$1Jun$2$3');
txt.value=txt.value.replace(/(\s)jul(|y|\.)(\s)/g, '$1Jul$2$3');
txt.value=txt.value.replace(/(\s)aug(|ust|\.)(\s)/g, '$1Aug$2$3');
txt.value=txt.value.replace(/(\s)sep(|tember|\.)(\s)/g, '$1Sep$2$3');
txt.value=txt.value.replace(/(\d{1,2}\s)sept(\s)/g, '$1Sep$2');
txt.value=txt.value.replace(/(\s)oct(|ober|\.)(\s)/g, '$1Oct$2$3');
txt.value=txt.value.replace(/(\s)nov(|ember|\.)(\s)/g, '$1Nov$2$3');
txt.value=txt.value.replace(/(\s)dec(|ember|\.)(\s)/g, '$1Dec$2$3');
txt.value=txt.value.replace(/(\d)(?:-|–|–)P(resent)/g, '$1 – p$2');
//underscore in linked dates - dmy
txt.value=txt.value.replace(/(\[\[[0-3]?\d)_(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\]\])/gi, '$1 $2$3');
//underscore in linked dates - mdy
txt.value=txt.value.replace(/(\[\[)(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))_([0-3]?\d\]\])/gi, '$1$2 $3');
//remove leading zero from linked date
txt.value=txt.value.replace(/(\[\[)(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s0(\d)(?:th|st|nd|rd|)(\]\])/gi, '$1$2 $3$4');
txt.value=txt.value.replace(/(\[\[)0(\d)(?:th|st|nd|rd|)\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|\.|))(\]\])/gi, '$1$2 $3$4');
//rem redundant spaces (and commas) in date formats
txt.value=txt.value.replace(/([^\d][^\w\d]\[?\[?[0-3]?\d)[ ]+(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{3,4}(\sAD|\sBC|\sCE|\sBCE|)\]?\]?[^\w\d][^\d])/gi, '$1 $2$3 $4');
txt.value=txt.value.replace(/([^\d][^\w\d]\[?\[?)(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))[ ]+([0-2]?\d|30|31)(\]?\]?)(?:[ ]*,[ ]*)(\[?\[?\d{3,4}(\sAD|\sBC|\sCE|\sBCE|)\]?\]?[^\w\d][^\d])/gi, '$1$2 $3$4, $5');
txt.value=txt.value.replace(/([^\d][^\w\d]\[?\[?)(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))[ ]+([0-2]?\d|30|31)(\]?\]?)[ ]+(\[?\[?\d{3,4}(\sAD|\sBC|\sCE|\sBCE|)\]?\]?[^\w\d][^\d])/gi, '$1$2 $3$4, $5');
txt.value=txt.value.replace(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(?:, | of )(\d{3,4}[\w\d])/gi, '$1 $2'); //repeat after delinking
Ohc_protect_dates_in_titles();
//remove unlinked ordinal date formats
txt.value=txt.value.replace(/(?:the\s?)?([1-3]?\d)(?:th|st|nd|rd|), ([1-3]?\d)(?: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\d])/g, '$1, $2$3 $4 $5');
txt.value=txt.value.replace(/(?:the\s?)?([1-3]?\d)(?: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\d])/g, '$1$2 $3$4');
txt.value=txt.value.replace(/(?:the\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\d])/g, '$1 $2$3');
txt.value=txt.value.replace(/(?:the\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\d])/g, '$1 $2$3');
txt.value=txt.value.replace(/(?:the\s?)?([1-3]?\d)<sup>(?:th|st|nd|rd|)<\/sup>(?:\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])/g, '$1 $2$3');
txt.value=txt.value.replace(/(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|),\s(?:the\s)?([1-3]?\d)(?:th|st|nd|rd|)(\s(?:and|&|to|or)\s)(?:the\s)?([1-3]?\d)(?:th|st|nd|rd|)([^\]\|\w\d][^\d])/g, '$1 $2, $3$4 $5$6');
txt.value=txt.value.replace(/(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|)(\s(?:and|&|to|or)\s)(?:the\s)?([1-3]?\d)(?:th|st|nd|rd|)([^\]\|\w\d][^\d])/g, '$1 $2$3$4$5');
txt.value=txt.value.replace(/(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])/g, '$1 $2$3');
txt.value=txt.value.replace(/(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)<sup>(?:th|st|nd|rd)<\/sup>([^\]\|\w\d][^\d])/g, '$1 $2$3');
//fix 'bda' template redirect
txt.value=txt.value.replace(/{{bda\|([^}]+)}}/gi, '{{birth date and age|$1}}');
//zap redundant templates ('date', 'as of', 'English', '#dateformat:')
txt.value=txt.value.replace(/\{\{date\|([^\}\|]+)(?:[^\}]+)?\}\}/gi, '$1');
txt.value=txt.value.replace(/{{#dateformat:([^\}\|]+)(?:\|dmy|\|mdy)?}}/gi,'$1');
}
function Ohc_protect_dates_in_titles(){
var txt=document.editform.wpTextbox1;
//permanent protection for dmy dates within images
txt.value=txt.value.replace(/((?:file|image|img)[\s]*[:=][^\|]{1,30})\s([0-2]?\d|30|31)(th|st|nd|rd|)(\sof)?\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(?:[12]?\d{3}))?/gi, '$1_$2$3$4_$5$6$7');
txt.value=txt.value.replace(/(\((?:file|image|img)[\s]*[:=][0-3]?\d)(th|st|nd|rd|)(\sof)?\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(?:[12]?\d{3}))?/gi, '$1$2$3_$4$5_$6$7');
txt.value=txt.value.replace(/([0-2]?\d|30|31)(th|st|nd|rd|)(\sof)?\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([12]\d{3})(\.jpe?g)/gi, '$1$2$3_$4$5_$6$7');
txt.value=txt.value.replace(/([0-2]?\d|30|31)(th|st|nd|rd|)(\sof)?\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|\.|))(\.jpe?g)/gi, '$1$2$3_$4$5');
//protect dmy date formats within titles of citation templates
txt.value=txt.value.replace(/(\|[ ]*(?:title|work|quote)[ ]*=[^\|]*)((?:[0-3]?\d)(?:th|st|nd|rd|),?(?:\sof)?)\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|\.|))([^\|]{0,30}\|)/gi, '$1$2 $3$4');
//blockquotes
txt.value=txt.value.replace(/(<blockquote>[^<]+?)((?:[0-3]?\d)(?:th|st|nd|rd|),?(?:\sof)?)\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[12]?\d{3})?([^<]+?<\/blockquote>)/g, '$1$2 $3$4$5');
//permanent protection for mdy dates within images
txt.value=txt.value.replace(/((?:file|image|img)[\s]*[:=][^\|]{1,60})\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|\.|))(\sthe)?\s([0-2]?\d|30|31)(th|st|nd|rd|)(,)?(\s(?:[12]?\d{3}))?/gi, '$1_$2$3_$4$5$6$7');
txt.value=txt.value.replace(/((?:file|image|img)[\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|\.|))(\sthe)?\s([0-2]?\d|30|31)(th|st|nd|rd|)(,)?(\s(?:[12]?\d{3}))?/gi, '$1$2$3_$4$5$6$7'); //re-enabled 13 Aug 2010
txt.value=txt.value.replace(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\sthe)?\s([0-2]?\d|30|31)(th|st|nd|rd|)(,)?\s([12]\d{3})(\.(?:png|jpe?g))/gi, '$1$2_$3$4$5_$6$7');
txt.value=txt.value.replace(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\sthe)?\s([0-2]?\d|30|31)(th|st|nd|rd|)(\.png|\.jpe?g)/gi, '$1$2_$3$4$5');
//protect mdy date formats within titles of citation templates
txt.value=txt.value.replace(/(\|[ ]*(?:title|work|quote|chapter)[ ]*=[^\|}]+?)([^\d][^\w\d])(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\sthe)?\s((?:[0-3]?\d)(?:th|st|nd|rd|))([^\w\d]|[ ]*?\||[ ]*?\})/gi, '$1$2$3$4 $5$6');
//blockquotes
txt.value=txt.value.replace(/(<blockquote>[^<]+?)([^\d][^\w\d])(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(\sthe)?\s((?:[0-3]?\d)(?:th|st|nd|rd|),?)\s([12]\d{3})([^<]+?<\/blockquote>)/g, '$1$2$3$4 $5 $6$7');
}
function Ohc_code_delink_dates() {
var txt=document.editform.wpTextbox1;
Ohc_protect_dates ();
Ohc_fix_common_errors();
//delink ISO8601 dates
txt.value=txt.value.replace(/\[\[([12]\d{3}-[0-1]\d-[0-3]\d)\]\]/gi, '$1');
txt.value=txt.value.replace(/\[\[([12]\d{3})\]\]-\[\[([0-1]\d-[0-3]\d)\]\]/gi, '$1-$2');
txt.value=txt.value.replace(/([12]\d{3})-\[\[([0-1]\d-[0-3]\d)\]\]/gi, '$1-$2');
txt.value=txt.value.replace(/\[\[([12]\d{3})\]\]-([0-1]\d-[0-3]\d)/gi, '$1-$2');
//delink full dates
txt.value=txt.value.replace(/\[\[([1-3]?\d)(?:th|st|nd|rd|)[\s_](?:of[\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|\.|))(?:\]\] \[\[| )([12]\d{3})\]\]/gi, '$1 $2 $3');
txt.value=txt.value.replace(/\[\[(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)) (?:the\s)?([1-3]?\d)(?:th|st|nd|rd|)(?:\]\],? \[\[|, )([12]\d{3})\]\]/gi, '$1 $2, $3');
//delink single dm or 'dth the m'
txt.value=txt.value.replace(/(?:the\s)?\[\[([1-3]?\d)(?:th|st|nd|rd|)[\s_](?:of[\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|\.|))\]\]/gi, '$1 $2');
//delink single md or 'm the dth'
txt.value=txt.value.replace(/\[\[(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])/gi, '$1 $2$3');
//Month+day_number "[[March 7]]th" -> "March 7"
txt.value=txt.value.replace(/\[\[((?: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)\]\](?:th|st|nd|rd)/gi, '$1');
//removal of 'year in foo' in full dates (with or without links) with incorrect '[[year in foo|YYYY]]'
// txt.value=txt.value.replace(/(\[?\[?(?: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(?:[0-3][\d]|[\d])\]?\]?),\s\[\[(\d{1,4})\sin\s[^\]]{1,32}\]\]/gi, '$1 $2');
// txt.value=txt.value.replace(/(\[?\[?(?: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(?:[0-3][\d]|[\d])\]?\]?),\s{{(?:avyear|by|fy|ly|mlb|scy|sdy)\|(\d{1,4})}}/gi, '$1 $2');
// txt.value=txt.value.replace(/(\[?\[?(?:[0-3][\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\[\[(\d{1,4})\sin\s[^\]]{1,32}\]\]/gi, '$1 $2');
// txt.value=txt.value.replace(/(\[?\[?(?:[0-3][\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{{(?:avyear|by|fy|ly|mlb|scy|sdy)\|(\d{1,4})}}/gi, '$1 $2');
//month+day+year piped pseudo-ISO dates
txt.value=txt.value.replace(/\[\[(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))( [0-2]?\d|30|31)\|[0-3]?\d-[0-3]?\d\]\]-(?:\[\[)?([1-2]\d\d\d)(\|\d{2,4})?(?:\]\])?/gi, '$1$2, $3');
txt.value=txt.value.replace(/\[\[([0-3]\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|\.|)))\|[0-3]?\d-[0-3]?\d\]\]-(?:\[\[)?([1-2]\d{3})(\]\])?/gi, '$1 $2');
//month+day piped
txt.value=txt.value.replace(/(?:the\s)?\[\[\d{1,2}(?:th|st|nd|rd|)[\s_](?:of[\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|\.|))\|([^\]]{1,30})\]\]/gi, '$1');
//'[[month day|xxXxx]]Xyyyy ' to 'month day, year'
txt.value=txt.value.replace(/\[\[(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{1,2})(?:th|st|nd|rd|)\|\d?\d\.\d?\d\]\].(\d{3,4})/gi, '$1 $2, $3');
//'[[day month|xxXxx]]Xyyyy' to 'day month year'
txt.value=txt.value.replace(/\[\[(\d{1,2})(?:th|st|nd|rd|)\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|\.|))\|\d?\d\.\d?\d\]\].(\d{3,4})/gi, '$1 $2 $3');
// century
txt.value=txt.value.replace(/\[\[((?: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|centuries)(\sAD|\sBC|\sCE|\sBCE|)\]\]/gi, '$1$2$3');
txt.value=txt.value.replace(/\[\[(?: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|centuries)(?:\sAD|\sBC|\sCE|\sBCE|)\|([^\]]{1,30})\]\]/gi, '$1');
txt.value=txt.value.replace(/\[\[(\d{1,2}(?:st|nd|rd|th)[\s-_])(century|centuries)(\sAD|\sBC|\sCE|\sBCE|)\]\]/gi, '$1$2$3');
txt.value=txt.value.replace(/\[\[\d{1,2}(?:st|nd|rd|th)[\s-_](?:century|centuries)(?:\sAD|\sBC|\sCE|\sBCE|)\|([^\]]{1,30})\]\]/gi, '$1');
// months
txt.value=txt.value.replace(/\[\[(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\]\]/gi, '$1');
txt.value=txt.value.replace(/\[\[(?:January|February|March|April|May|June|July|August|September|October|November|December)\|([^\]]{1,30})\]\]/gi, '$1');
// decades and years
txt.value=txt.value.replace(/\[\[(\d{1,3}0)\'?s\]\]/g, '$1s');
txt.value=txt.value.replace(/\[\[\d{1,3}0\'?s?\|([^\]]{1,30})\]\]/g, '$1');
txt.value=txt.value.replace(/\[\[(\d{1,3}0)\'?(s)?\s(AD|BC|CE|BCE)\]\]/gi, '$1$2 $3');
txt.value=txt.value.replace(/\[\[(\d{1,4}[\s_]?)(AD|BC|CE|BCE|)\]\]/gi, '$1$2');
txt.value=txt.value.replace(/\[\[(AD|BC|CE|BCE|)([\s_]?)(\d{1,4})\]\]/gi, '$3$2$1');
txt.value=txt.value.replace(/\[\[\d{1,3}0\'?s?\s(?:AD|BC|CE|BCE)\|([^\]]{1,30})\]\]/gi, '$1');
txt.value=txt.value.replace(/\[\[\d{1,3}0\'?s?\s\(decade\)\|([^\]]{1,30})\]\]/gi, '$1');
txt.value=txt.value.replace(/\[\[([MDCLXVI]{3,10})\]\]/g, '$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
txt.value=txt.value.replace(/\[\[\d{1,4}#[^\|\]]+\|((?: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})\]\]/gi, '$1');
txt.value=txt.value.replace(/\[\[((?: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})\]\]/gi, '$1');
txt.value=txt.value.replace(/\[\[(?: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
txt.value=txt.value.replace(/(\[\[\d{1,2}\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,32}\|(\d{1,4}\]\])/gi, '$1$2');
txt.value=txt.value.replace(/(\[\[(?: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{1,2}\]\],?\s?\[\[)[^\|\]]{1,32}\|(\d{1,4}\]\])/gi, '$1$2');
//Identify surprise or 'Easter egg' diversions linking months to year articles.
txt.value=txt.value.replace(/\[\[\d{1,4}#[^\|\]]+\|(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.?|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\]\]/gi, '$1');
// month and day piped
txt.value=txt.value.replace(/(\d{4,4}-)\[\[(?: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{1,2}(?:th|st|nd|rd|)\|(\d-)(\d)\]\]/gi, '$10$20$3');
txt.value=txt.value.replace(/(\d{4,4}-)\[\[(?: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{1,2}(?:th|st|nd|rd|)\|(\d\d-)(\d)\]\]/gi, '$1$20$3');
txt.value=txt.value.replace(/(\d{4,4}-)\[\[(?: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{1,2}(?:th|st|nd|rd|)\|(\d-)(\d\d)\]\]/gi, '$10$2$3');
txt.value=txt.value.replace(/\[\[(?: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{1,2}(?:th|st|nd|rd|)\|([^\]]{1,30})\]\]/gi, '$1');
txt.value=txt.value.replace(/\[\[\d{1,2}(?:th|st|nd|rd|)[\s_](?:of[\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|\.|))\|([^\]]{1,30})\]\]/gi, '$1');
txt.value=txt.value.replace(/\[\[(\d{1,2}(?:st|nd|rd|th))\]\]/gi, '$1');
//4 digit years piped
txt.value=txt.value.replace(/\[\[\d{1,4}\|([^\]]{1,30})\]\]/gi, '$1');
txt.value=txt.value.replace(/(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))(?:, | of )(\d{3,4}[\w\d])/gi, '$1 $2'); //repeat removal of commas and 'of' between month and year
// spaces and commas - mdy birth and death date ranges
txt.value=txt.value.replace(/([^\d][^\w\d])(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([0-2]?\d|30|31),? (\d{1,3}|[12]?\d{3})(?:[ ]*[-–][ ]*)(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([0-2]?\d|30|31),? (\d{1,3}|[12]?\d{3})([^\d][^\w\d])/gi, '$1$2 $3, $4 – $5 $6, $7$8');
//dmy birth and death date ranges)
txt.value=txt.value.replace(/([^\d][^\w\d])([0-2]?\d|30|31)\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|\.|)),? (\d{1,3}|[12]?\d{3})(?:\s?[-–]\s?)([0-2]?\d|30|31)\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|\.|)),? (\d{1,3}|[12]?\d{3})([^\d][^\w\d])/gi, '$1$2 $3 $4 – $5 $6 $7$8');
}
function Ohc_delink_ISO_to_dmy() {
var txt = document.editform.wpTextbox1;
txt.value = yyyymmdd_to_dmy(txt.value); // adapted from User:Plastikspork/datetools.js
txt.value=txt.value.replace(/([^\d\w\/\-%,])([12]\d{3}-\d\d-\d\d)(<\s?\/ref.*?>)/g, '$1$2 $3');
//code to convert ref ISO-dates outside citation templates
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-01-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 January $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-02-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 February $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-03-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 March $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-04-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 April $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-05-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 May $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-06-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 June $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-07-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 July $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-08-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 August $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-09-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 September $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-10-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 October $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-11-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 November $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-12-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 December $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-01-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 January $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-02-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 February $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-03-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 March $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-04-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 April $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-05-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 May $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-06-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 June $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-07-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 July $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-08-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 August $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-09-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 September $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-10-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 October $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-11-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 November $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-12-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2$4 December $3$5$6');
Ohc_remove_leading_zeros_from_nonlinked_dates ();
}
function Ohc_delink_ISO_to_mdy() {
var txt = document.editform.wpTextbox1;
txt.value = yyyymmdd_to_mdy(txt.value); // adapted from User:Plastikspork/datetools.js
txt.value=txt.value.replace(/([^\d\w\/\-%,])(\d{4}-\d\d-\d\d)(<\s?\/ref.*?>)/g, '$1$2 $3');
//code to convert ref ISO-dates outside citation templates
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-01-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2January $4, $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-02-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2February $4, $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-03-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2March $4, $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-04-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2April $4, $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-05-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2May $4, $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-06-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2June $4, $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-07-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2July $4, $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-08-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2August $4, $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-09-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2September $4, $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-10-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2October $4, $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-11-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2November $4, $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-12-0(\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2December $4, $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-01-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2January $4, $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-02-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2February $4, $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-03-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2March $4, $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-04-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2April $4, $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-05-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2May $4, $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-06-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2June $4, $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-07-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2July $4, $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-08-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2August $4, $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-09-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2September $4, $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-10-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2October $4, $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-11-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2November $4, $3$5$6');
txt.value=txt.value.replace(/(<\s?ref.*?>[^<]+?)([\s\(])([12]\d{3})-12-([1-3]\d)([^\d\w\/\-%,])([^<]*?<\s?\/ref.*?>)/g, '$1$2December $4, $3$5$6');
Ohc_remove_leading_zeros_from_nonlinked_dates ();
}
function Ohc_delink_year_in_X(){
var txt=document.editform.wpTextbox1;
txt.value=txt.value.replace(/{{(?:avyear|by|baseball\syear|fy|ly|mlby|mlb\syear|scy|sdy)\|(\d{1,4})}}/gi, '$1');
txt.value=txt.value.replace(/{{(?:avyear|by|baseball\syear|fy|ly|mlby|mlb\syear|scy|sdy)\|(?:\d{1,4})\|(\d{1,4})}}/gi, '$1');
txt.value=txt.value.replace(/\[\[\d{1,4}\sin\s[^\|]+\|(\d{1,4})\]\]/gi, '$1');
txt.value=txt.value.replace(/\[\[(?:\d{4}.\d{2} in English football)\|([^\]]{1,30})\]\]/gi, '$1');
txt.value=txt.value.replace(/\[\[\d{4,4} Major League Baseball season\|(\d{4,4})(\sseason)?\]\]/gi, '$1$2');
}
var linkmap=[];
function Ohc_protect_dates(){
var txt=document.editform.wpTextbox1;
txt.value=txt.value.replace(/Image:[^|]+/gi, function(img){
linkmap.push(img);
return "\x02"+(linkmap.length-1)+"\x03";
});
//protect certain dates
txt.value=txt.value.replace(/(\[\[4)(AD)/gi, '$1♫$2');
txt.value=txt.value.replace(/(March )((?:8|14) Alliance)/gi, '$1♫$2');
txt.value=txt.value.replace(/(movement 2) (June)/gi, '$1♫$2');
txt.value=txt.value.replace(/(6th\sof\s)(October City)/gi, '$1♫$2');
txt.value=txt.value.replace(/(19th\sof\s)(April movement)/gi, '$1♫$2');
txt.value=txt.value.replace(/(\[\[May\s1968)(\]\])/gi, '$1 in France|May 1968$2');
txt.value=txt.value.replace(/(\[\[June )(1, 1974\]\])/gi, '$1♫$2'); //June 1, 1974 is the name of an album
txt.value=txt.value.replace(/(\'\'June )(1, 1974\'\')/gi, '$1♫$2');
txt.value=txt.value.replace(/(\[\[)((?:2300|2000)\s?AD\]\])/gi, '$1:$2');
}
function Ohc_unprotect_dates(){
var txt=document.editform.wpTextbox1;
//unprotect certain dates
txt.value=txt.value.replace(/(\[\[4)♫(AD)/gi, '$1♫$2');
txt.value=txt.value.replace(/(\[\[(?:8|14))♫(March Alliance)/gi, '$1$2');
txt.value=txt.value.replace(/(movement 2)♫(June)/gi, '$1 $2');
txt.value=txt.value.replace(/(6th\sof\s)♫(October City)/gi, '$1$2');
txt.value=txt.value.replace(/(19th\sof\s)♫(April movement)/gi, '$1$2');
txt.value=txt.value.replace(/(June )♫(1, 1974)/gi, '$1$2');
txt.value=txt.value.replace(/(\w)♫(\w)/g, '$1$2'); //2010-10-06 quick patch to remove any spurious protection markers
txt.value=txt.value.replace(/\x02([0-9]+)\x03/g, function(x, n){
return linkmap[n];
});
}
function Ohc_remove_leading_zeros_from_nonlinked_dates () {
var txt=document.editform.wpTextbox1;
//remove leading zero from nonlinked date
txt.value=txt.value.replace(/([^\d][^\w\d])(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s0(\d)(?:th|st|nd|rd|),?\s([12]\d{3})([^\w\d][^\d]|\b)/gi, '$1$2 $3, $4$5');
txt.value=txt.value.replace(/([^\d][^\w\d])0(\d)(?:th|st|nd|rd|)\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([12]\d{3})([^\w\d][^\d]|\b)/gi, '$1$2 $3 $4$5');
txt.value=txt.value.replace(/([^\d][^\w\d])(Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))\s0(\d)(?:th|st|nd|rd|)([^\w\d][^\d]|\b)/gi, '$1$2 $3$4');
txt.value=txt.value.replace(/([^\d][^\w\d])0(\d)(?:th|st|nd|rd|)\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][^\d]|\b)/gi, '$1$2 $3$4');
}
function Ohc_dates_to_dmy(){
var txt=document.editform.wpTextbox1;
// insert 'dmy' template
txt.value=txt.value.replace(/{{(use (dmy|mdy) dates|dmy|mdy)(\|[^}]*)?}}/gi, '{{Use dmy dates|date=January 2011}}');
if (txt.value.search(/{{Use dmy dates|date=January 2011}}/gi) == -1)
{
txt.value='{{Use dmy dates|date=January 2011}}\r\n'+txt.value;
}
Ohc_code_delink_dates();
//repeat protect dates because 'unprotect dates' function is within 'delink dates' function
Ohc_protect_dates();
//change start and end templates
txt.value=txt.value.replace(/({{(start\sdate|end\sdate)[^|]*\|)df=ye?s?\|([^}]*df=ye?s?)/gi, '$1$2');
//change deprecated birth and death templates
txt.value=txt.value.replace(/({{(?:Birth|Death|release|start date|end date)[^}]*)\|mf=ye?s?/gi, '$1');
txt.value=txt.value.replace(/({{(?:Birth|Death|release|start date|end date)[^|]*\|)/gi, '$1df=yes|');
txt.value=txt.value.replace(/({{(?:Birth|Death|release|start date|end date)[^|]*\|)df=ye?s?\|([^}]*df=ye?s?)/gi, '$1$2');
//convert mdy-mdy to dmy-dmy (birth and death date ranges)
txt.value=txt.value.replace(/([^\d][^\w\d])(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([0-2]?\d|30|31), ([12]?\d{0,3})(?:\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([0-2]?\d|30|31), ([12]?\d{0,3})([^\d][^\w\d])/g, '$1$3 $2 $4 – $6 $5 $7$8');
//convert md-mdy date ranges to dm-dmy
txt.value=txt.value.replace(/([^\d][^\w\d])(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([0-2]?\d|30|31)(?:th|st|nd|rd|)((?:,\s[0-3]?\d(?:th|st|nd|rd|)){0,6}),?(\/|\s?[-–]\s?|\s(?:and|to|&)\s)([0-2]?\d|30|31)(?:th|st|nd|rd|),?\s(?:of\s)?(\d{3,4}[^\w\d][^\d])/g, '$1$3$4$5$6 $2 $7');
//test code txt.value=txt.value.replace(/([^\d][^\w\d])(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([0-2]?\d|30|31)(?:th|st|nd|rd|)((?:,?\s[0-3]?\d(?:th|st|nd|rd|)){0,6}),? ([0-2]?\d|30|31)(?:th|st|nd|rd|),?\s(?:of\s)?(\d{3,4}[^\w\d][^\d])/g, '$1$3$4, $5 $2$6');
txt.value=txt.value.replace(/([^\d][^\w\d])(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([0-2]?\d|30|31)(?:th|st|nd|rd|)((?:,\s[0-3]?\d(?:th|st|nd|rd|)){0,6}), ([0-2]?\d|30|31)(?:th|st|nd|rd|)([^\w\d][^\d]|\b)/g, '$1$3$4, $5 $2$6');
//convert md,d,d, date ranges to d,d,dm (multiple, separated by commas)
txt.value=txt.value.replace(/([^\d][^\w\d])(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)(?:th|st|nd|rd|)((?:,?\s[0-3]?\d(?:th|st|nd|rd|)){0,6}),?(\/|\s?[-–]\s?|\s(?:and|to|&)\s)([0-2]?\d|30|31)(?:th|st|nd|rd|)([^\w\d][^\d]|\b)/g, '$1$3$4$5$6 $2$7');
txt.value=txt.value.replace(/([^\d][^\w\d])(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(?:th|st|nd|rd|),?){1,6})(\s(?:and|to|&)\s)([0-2]?\d|30|31)(?:th|st|nd|rd|)([^\w\d][^\d]|\b)/g, '$1$3$4$5 $2$6');
txt.value=txt.value.replace(/([^\d][^\w\d])(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)(?:th|st|nd|rd|)((?:,?\s[1-3]?\d(?:th|st|nd|rd|)){1,6})([^\w\d][^\d]|\b)/g, '$1$3$4 $2$5');
//convert md date ranges to dm (simple, separated by hyphens and dashes or 'to')
txt.value=txt.value.replace(/([^\d][^\w\d])(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)(?:th|st|nd|rd|)(\s?[-–]\s?|\sto\s)([0-2]?\d|30|31)(?:th|st|nd|rd|)([^\w\d][^\d]|\b)/g, '$1$3 $4$5 $2$6');
//'md, md,' to 'dm, dm,'
txt.value=txt.value.replace(/([^\d])( (Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)))( [0-2]?\d|30|31),( (Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|)))( [0-2]?\d|30|31)([,\.][^\w\d][^\d])/g, '$1$3$2,$5$4,$6');
//convert simple mdy dates to dmy
txt.value=txt.value.replace(/([^\d][^\w\d])(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([0-2]?\d|30|31)(?:th|st|nd|rd|),?\s(\d{1,4}\s?(?:AD|BC|CE|BCE)[^\w\d][^\d])/g, '$1$3 $2 $4');
txt.value=txt.value.replace(/([^\d][^\w\d])(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([0-2]?\d|30|31)(?:th|st|nd|rd|),?\s([12]\d{3})([^\w\d][^\d]|\b)/g, '$1$3 $2 $4$5');
txt.value=txt.value.replace(/([^\d][^\w\d])(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([0-2]?\d|30|31)(?:th|st|nd|rd|)([^\w\d][^\d]|\b)/g, '$1$3 $2$4');
//Repeat line to capture some instances that get missed first time
//(needed because the date component 'September 19, 1881' within the string 'March 4-September 19, 1881' is blocked from conversion by the '4')
txt.value=txt.value.replace(/([^\d][^\w\d])(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([0-2]?\d|30|31)(?:th|st|nd|rd|),?\s(\d{1,4})([^\w\d][^\d]|\b)/g, '$1$3 $2 $4$5');
//Month+day_number " 7th March" -> "7 March"
txt.value=txt.value.replace(/([^\d][^\w\d])([0-2]?\d|30|31)(?:th|st|nd|rd|)\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(\d{1,4})([^\w\d][^\d]|\b)/g, '$1$2 $3 $4$5');
txt.value=txt.value.replace(/([^\d][^\w\d])([0-2]?\d|30|31)(?:th|st|nd|rd|)\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][^\d]|\b)/g, '$1$2 $3$4');
Ohc_remove_leading_zeros_from_nonlinked_dates ();
//remove comma in International date format
txt.value=txt.value.replace(/([1-3]?\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{3,4})([^\w\d])/g, '$1 $2 $3$4');
Ohc_unprotect_dates();
}
function Ohc_dates_to_mdy(){
var txt=document.editform.wpTextbox1;
// insert 'mdy' template
txt.value=txt.value.replace(/{{(use (dmy|mdy) dates|dmy|mdy)(\|[^}]*)?}}/gi, '{{Use mdy dates|date=January 2011}}');
if (txt.value.search(/{{Use mdy dates|date=January 2011}}/gi) == -1)
{
txt.value='{{Use mdy dates|date=January 2011}}\r\n'+txt.value;
}
Ohc_code_delink_dates();
//repeat protect dates because 'unprotect dates' function is within 'delink dates' function
Ohc_protect_dates();
//change deprecated birth and death templates
txt.value=txt.value.replace(/({{(?:Birth|Death|release|start date|end date)[^}]*)\|df=ye?s?/gi, '$1');
// txt.value=txt.value.replace(/({{(?:Birth|Death|release|start date|end date)[^|]*\|)/gi, '$1mf=yes|');
txt.value=txt.value.replace(/({{(?:Birth|Death|release|start date|end date)[^|]*\|)mf=ye?s?\|([^}]*mf=ye?s?)/gi, '$1$2');
//convert dmy-dmy to mdy-mdy (birth and death date ranges)
txt.value=txt.value.replace(/([^\d][^\w\d])([0-2]?\d|30|31)\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|\.|)),? ([12]?\d{0,3})(?:\s?[-–]\s?)([0-2]?\d|30|31)\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|\.|)),? ([12]?\d{0,3})([^\d][^\w\d])/g, '$1$3 $2, $4 – $6 $5, $7$8');
//convert dm-dmy date ranges to md-mdy
txt.value=txt.value.replace(/([^\d][^\w\d])((?:[0-3]?\d)(?:th|st|nd|rd|),\s){0,6}([0-2]?\d|30|31)(?:th|st|nd|rd|)(\/|[\s]{0,3}(?:and|to|&|-|–)[\s]{0,3})([0-2]?\d|30|31)(?:th|st|nd|rd|)\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(\d{3,4}[^\w\d][^\d])/g, '$1$6 $2$3$4$5, $7');
//convert d,d,dm date ranges to md,d,d (multiple, separated by commas)
txt.value=txt.value.replace(/([^\d][^\w\d])((?:[0-3]?\d(?:th|st|nd|rd|),?\s){0,6})([0-2]?\d|30|31)(?:th|st|nd|rd|)(\/|[\s]{0,3}(?:and|to|&|-|–)[\s]{0,3})([0-2]?\d|30|31)(?:th|st|nd|rd|)\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][^\d]|\b)/g, '$1$6 $2$3$4$5$7');
txt.value=txt.value.replace(/([^\d][^\w\d])((?:[0-3]?\d(?:th|st|nd|rd|),?[\s]{1,3}){1,6})([0-2]?\d|30|31)(?:th|st|nd|rd|)\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][^\d]|\b)/g, '$1$4 $2$3$5');
//convert dm date ranges to md (simple, separated by hyphen, dash or 'to')
txt.value=txt.value.replace(/([^\d][^\w\d])([0-2]?\d|30|31)(?:th|st|nd|rd|)([\s]{0,3}[-–][\s]{0,3}|\sto[\s]{0,3})([0-2]?\d|30|31)(?:th|st|nd|rd|)[\s]{1,3}(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][^\d]|\b)/g, '$1$5 $2$3$4$6');
//'dm, dm,' to 'md, md,'
txt.value=txt.value.replace(/([^\d])( [0-2]?\d|30|31)( (Jan(?:uary|\.|)|Feb(?:ruary|\.|)|Mar(?:ch|\.|)|Apr(?:il|\.|)|May\.?|Jun(?:e|\.|)|Jul(?:y|\.|)|Aug(?:ust|\.|)|Sep(?:tember|\.|t\.|)|Oct(?:ober|\.|)|Nov(?:ember|\.|)|Dec(?:ember|\.|))),( [0-2]?\d|30|31)( (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][^\d])/g, '$1$3$2,$5$4,$6');
txt.value=txt.value.replace(/([^\d][^\w\d])([0-2]?\d|30|31)(?:th|st|nd|rd|)[\s]{1,3}(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{1,4}\s?(?:AD|BC|CE|BCE)[^\w\d][^\d])/g, '$1$3 $2, $4');
txt.value=txt.value.replace(/([^\d][^\w\d])([0-2]?\d|30|31)(?:th|st|nd|rd|)[\s]{1,3}(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([12]\d{3})([^\w\d][^\d]|\b)/g, '$1$3 $2, $4$5');
txt.value=txt.value.replace(/([^\d][^\w\d])([0-2]?\d|30|31)(?:th|st|nd|rd|)[\s]{1,3}(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][^\d]|\b)/g, '$1$3 $2$4');
//repeat previous two bits of code to capture some date ranges that were missed first time round
// txt.value=txt.value.replace(/([^\d][^\w\d])([0-2]?\d|30|31)(?:th|st|nd|rd|)\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(\d{1,4})([^\w\d][^\d]|\b)/g, '$1$3 $2, $4$5');
// txt.value=txt.value.replace(/([^\d][^\w\d])([0-2]?\d|30|31)(?:th|st|nd|rd|)\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][^\d]|\b)/g, '$1$3 $2$4');
//Month+day_number "March 7th" -> "March 7"
txt.value=txt.value.replace(/([^\d][^\w\d])(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([0-2]?\d|30|31)(?:th|st|nd|rd)([^\w\d][^\d]|\b)/g, '$1$2 $3$4');
//add comma when missing
txt.value=txt.value.replace(/([^\d][^\w\d])(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([0-2]?\d|30|31)(?:th|st|nd|rd|)(\s\d{1,4}[^\w\d][^\d])/g, '$1$2 $3,$4');
Ohc_remove_leading_zeros_from_nonlinked_dates ();
Ohc_unprotect_dates();
}
function Ohc_MOSNUM_edit_summary(){
// Add a tag to the summary box
var txt=document.editform.wpSummary;
var summary = "date formats per [[WP:MOSNUM]] by [[WP:MOSNUMscript|script]]";
if (txt.value.indexOf(summary) == -1) {
if (txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) {
txt.value += ", ";
}
txt.value += summary;
}
// document.forms.editform.wpMinoredit.checked = true;
document.editform.wpDiff.click();
}
function yyyymmdd_to_dmy(str) {
// This code adapted from User:Plastikspork/datetools.js
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?1-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 January $2');
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?2-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 February $2');
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?3-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 March $2');
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?4-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 April $2');
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?5-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 May $2');
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?6-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 June $2');
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?7-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 July $2');
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?8-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 August $2');
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?9-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 September $2');
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)10-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 October $2');
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)11-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 November $2');
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)12-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 December $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?1-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 January $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?2-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 February $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?3-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 March $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?4-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 April $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?5-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 May $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?6-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 June $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?7-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 July $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?8-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 August $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?9-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 September $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)10-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 October $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)11-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 November $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)12-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1$3 December $2');
return str;
}
function yyyymmdd_to_mdy(str) {
// This code adapted from User:Plastikspork/datetools.js
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?1-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1January $3, $2');
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?2-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1February $3, $2');
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?3-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1March $3, $2');
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?4-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1April $3, $2');
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?5-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1May $3, $2');
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?6-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1June $3, $2');
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?7-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1July $3, $2');
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?8-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1August $3, $2');
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?9-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1September $3, $2');
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)10-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1October $3, $2');
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)11-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1November $3, $2');
str=str.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)12-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1December $3, $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?1-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1January $3, $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?2-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1February $3, $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?3-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1March $3, $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?4-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1April $3, $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?5-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1May $3, $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?6-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1June $3, $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?7-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1July $3, $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?8-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1August $3, $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)0?9-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1September $3, $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)10-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1October $3, $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)11-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1November $3, $2');
str=str.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:\[\[)?([1-2][0-9]{3})(?:\]\]-\[\[|-)12-(0[1-9]|[1-2][0-9]|30|31)(?:\]\])?/gi, '$1December $3, $2');
return str;
}
function Ohc_cite_dates_to_ISO() {
var txt=document.editform.wpTextbox1;
// |date = 13 Jan. 2006 |
// |date = 13 January 2006 |
// txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)([1-3]\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-2]\d{3})([\s]*[\}\|])/gi, '$1$3-01-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)([1-3]\d)\s(?:Jan(?:uary|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-01-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)([1-2]\d)\s(?:Feb(?:ruary|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-02-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)([1-3]\d)\s(?:Mar(?:ch|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-03-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)([1-3]\d)\s(?:Apr(?:il|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-04-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)([1-3]\d)\s(?:May)\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-05-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)([1-3]\d)\s(?:Jun(?:e|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-06-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)([1-3]\d)\s(?:Jul(?:y|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-07-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)([1-3]\d)\s(?:Aug(?:ust|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-08-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)([1-3]\d)\s(?:Sep(?:tember|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-09-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)([1-3]\d)\s(?:Oct(?:ober|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-10-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)([1-3]\d)\s(?:Nov(?:ember|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-11-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)([1-3]\d)\s(?:Dec(?:ember|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-12-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(\d)\s(?:Jan(?:uary|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-01-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(\d)\s(?:Feb(?:ruary|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-02-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(\d)\s(?:Mar(?:ch|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-03-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(\d)\s(?:Apr(?:il|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-04-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(\d)\s(?:May)\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-05-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(\d)\s(?:Jun(?:e|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-06-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(\d)\s(?:Jul(?:y|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-07-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(\d)\s(?:Aug(?:ust|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-08-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(\d)\s(?:Sep(?:tember|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-09-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(\d)\s(?:Oct(?:ober|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-10-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(\d)\s(?:Nov(?:ember|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-11-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(\d)\s(?:Dec(?:ember|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-12-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)([1-3]\d)\s(?:Jan(?:uary|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-01-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)([1-2]\d)\s(?:Feb(?:ruary|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-02-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)([1-3]\d)\s(?:Mar(?:ch|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-03-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)([1-3]\d)\s(?:Apr(?:il|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-04-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)([1-3]\d)\s(?:May)\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-05-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)([1-3]\d)\s(?:Jun(?:e|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-06-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)([1-3]\d)\s(?:Jul(?:y|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-07-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)([1-3]\d)\s(?:Aug(?:ust|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-08-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)([1-3]\d)\s(?:Sep(?:tember|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-09-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)([1-3]\d)\s(?:Oct(?:ober|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-10-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)([1-3]\d)\s(?:Nov(?:ember|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-11-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)([1-3]\d)\s(?:Dec(?:ember|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-12-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(\d)\s(?:Jan(?:uary|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-01-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(\d)\s(?:Feb(?:ruary|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-02-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(\d)\s(?:Mar(?:ch|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-03-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(\d)\s(?:Apr(?:il|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-04-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(\d)\s(?:May)\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-05-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(\d)\s(?:Jun(?:e|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-06-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(\d)\s(?:Jul(?:y|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-07-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(\d)\s(?:Aug(?:ust|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-08-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(\d)\s(?:Sep(?:tember|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-09-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(\d)\s(?:Oct(?:ober|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-10-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(\d)\s(?:Nov(?:ember|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-11-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(\d)\s(?:Dec(?:ember|\.|))\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-12-0$2$4');
// |date = Jan. 13, 2006 |
// |date = January 13, 2006 |
// |date = Jan. 13 2006 |
// |date = January 13 2006 |
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:Jan(?:uary|\.|))\s([1-3]\d),\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-01-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:Feb(?:ruary|\.|))\s([1-2]\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-02-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:Mar(?:ch|\.|))\s([1-3]\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-03-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:Apr(?:il|\.|))\s([1-3]\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-04-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:May)\s([1-3]\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-05-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:Jun(?:e|\.|))\s([1-3]\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-06-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:Jul(?:y|\.|))\s([1-3]\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-07-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:Aug(?:ust|\.|))\s([1-3]\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-08-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:Sep(?:t.?|tember|\.|))\s([1-3]\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-09-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:Oct(?:ober|\.|))\s([1-3]\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-10-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:Nov(?:ember|\.|))\s([1-3]\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-11-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:Dec(?:ember|\.|))\s([1-3]\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-12-$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:Jan(?:uary|\.|))\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-01-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:Feb(?:ruary|\.|))\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-02-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:Mar(?:ch|\.|))\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-03-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:Apr(?:il|\.|))\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-04-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:May)\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-05-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:Jun(?:e|\.|))\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-06-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:Jul(?:y|\.|))\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-07-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:Aug(?:ust|\.|))\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-08-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:Sep(?:tember|\.|))\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-09-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:Oct(?:ober|\.|))\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-10-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:Nov(?:ember|\.|))\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-11-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*(?:date|archivedate)[ ]*=[ ]*)(?:Dec(?:ember|\.|))\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-12-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:Jan(?:uary|\.|))\s([1-3]\d),\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-01-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:Feb(?:ruary|\.|))\s([1-2]\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-02-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:Mar(?:ch|\.|))\s([1-3]\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-03-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:Apr(?:il|\.|))\s([1-3]\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-04-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:May)\s([1-3]\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-05-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:Jun(?:e|\.|))\s([1-3]\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-06-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:Jul(?:y|\.|))\s([1-3]\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-07-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:Aug(?:ust|\.|))\s([1-3]\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-08-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:Sep(?:t.?|tember|\.|))\s([1-3]\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-09-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:Oct(?:ober|\.|))\s([1-3]\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-10-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:Nov(?:ember|\.|))\s([1-3]\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-11-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:Dec(?:ember|\.|))\s([1-3]\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-12-$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:Jan(?:uary|\.|))\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-01-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:Feb(?:ruary|\.|))\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-02-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:Mar(?:ch|\.|))\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-03-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:Apr(?:il|\.|))\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-04-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:May)\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-05-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:Jun(?:e|\.|))\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-06-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:Jul(?:y|\.|))\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-07-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:Aug(?:ust|\.|))\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-08-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:Sep(?:tember|\.|))\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-09-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:Oct(?:ober|\.|))\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-10-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:Nov(?:ember|\.|))\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-11-0$2$4');
txt.value=txt.value.replace(/(\|[ ]*accessdate[ ]*=[ ]*)(?:Dec(?:ember|\.|))\s(\d),?\s([1-2]\d{3})([\s]*[\}\|])/gi, '$1$3-12-0$2$4');
}
function Ohc_all_dates_to_dmy() {
Ohc_formatgeneral()
Ohc_dates_to_dmy();
Ohc_delink_ISO_to_dmy();
Ohc_delink_year_in_X();
Ohc_MOSNUM_edit_summary();
}
function Ohc_all_dates_to_mdy() {
Ohc_formatgeneral()
Ohc_dates_to_mdy();
Ohc_delink_ISO_to_mdy();
Ohc_delink_year_in_X();
Ohc_MOSNUM_edit_summary();
}
function Ohc_body_to_dmy() {
Ohc_formatgeneral()
Ohc_dates_to_dmy();
Ohc_MOSNUM_edit_summary();
}
function Ohc_body_to_mdy() {
Ohc_formatgeneral()
Ohc_dates_to_mdy();
Ohc_MOSNUM_edit_summary();
}
function Ohc_ISO_to_dmy() {
Ohc_delink_ISO_to_dmy();
// Ohc_MOSNUM_edit_summary();
}
function Ohc_ISO_to_mdy() {
Ohc_delink_ISO_to_mdy();
// Ohc_MOSNUM_edit_summary();
}
$(function () {
if(document.forms.editform) {
mw.util.addPortletLink('p-tb', 'javascript:Ohc_all_dates_to_dmy()', 'ALL dates to dmy', 'ca-unitfixer', 'Align all dates to dmy', '', '');
mw.util.addPortletLink('p-tb', 'javascript:Ohc_all_dates_to_mdy()', 'ALL dates to mdy', 'ca-unitfixer', 'Align all dates to mdy', '', '');
mw.util.addPortletLink('p-tb', 'javascript:Ohc_body_to_dmy()', 'Body dates to dmy', 't-dmy', 'day month', '', '');
mw.util.addPortletLink('p-tb', 'javascript:Ohc_body_to_mdy()', 'Body dates to mdy', 't-mdy', 'month day', '', '');
mw.util.addPortletLink('p-tb', 'javascript:Ohc_ISO_to_dmy()', 'ISO to dmy', 't-ISOdmy', 'ISO day month', '', '');
mw.util.addPortletLink('p-tb', 'javascript:Ohc_ISO_to_mdy()', 'ISO to mdy', 't-ISOmdy', 'ISO month day', '', '');
mw.util.addPortletLink('p-tb', 'javascript:Ohc_delink_year_in_X()' , 'Del year-in-X dates', 't-yearinX', 'Year in X', '', '');
mw.util.addPortletLink('p-tb', 'javascript:Ohc_unambiguous_dates()', 'unambiguous dates', 't-slash', 'resolves slash date format', '', '');
mw.util.addPortletLink('p-tb', 'javascript:Ohc_US_slash_dates()', 'US-slash dates', 't-US', 'US-slash', '', '');
mw.util.addPortletLink('p-tb', 'javascript:Ohc_UK_slash_dates()', 'UK-slash dates', 't-UK', 'UK-slash', '', '');
}
});
//</nowiki>
// </nowiki>