User:Sligocki/unlinkdates.js

// Unlinks linked dates in an article. Some dates are linked for a reason, check after yourself. function autoEdUnlinkDates(str) { // October 21, 2007 str = str.replace(/\[\[(January|February|March|April|May|June|July|August|September|October|November|December)\s+([0-3]?\d)\]\],?\s+\[\[(\d\d\d\d)\]\]/gi, '$1 $2, $3'); // 21 October 2007 str = str.replace(/\[\[([0-3]?\d)\s+(January|February|March|April|May|June|July|August|September|October|November|December)\]\],?\s+\[\[(\d\d\d\d)\]\]/gi, '$1 $2 $3'); // 2007-10-21 str = str.replace(/\[\[(\d\d\d\d\-\d\d\-\d\d)\]\]/gi, '$1'); // 2007-10-21 str = str.replace(/\[\[(\d\d\d\d)\]\]\-\[\[(\d\d\-\d\d)\]\]/gi, '$1-$2'); // October 21 str = str.replace(/\[\[(January|February|March|April|May|June|July|August|September|October|November|December)\s+([0-3]?\d)\]\]/gi, '$1 $2'); // 21 str = str.replace(/\[\[(January|February|March|April|May|June|July|August|September|October|November|December)\s+([0-3]?\d)\|\2\]\]/gi, '$2'); // 21 October str = str.replace(/\[\[([0-3]?\d)\s+(January|February|March|April|May|June|July|August|September|October|November|December)\]\]/gi, '$1 $2'); // 21 str = str.replace(/\[\[([0-3]?\d)\s+(January|February|March|April|May|June|July|August|September|October|November|December)\|\1\]\]/gi, '$1'); // 2007 str = str.replace(/\[\[(\d\d\d\d)\]\]/gi, '$1'); // 07 // str = str.replace(/\[\[(\d\d)(\d\d)\|\2\]\]/gi, '$2'); // October 2007 str = str.replace(/\[\[(January|February|March|April|May|June|July|August|September|October|November|December)\s+(\d\d\d\d)\]\]/gi, '$1 $2'); return str; }

//