On 4 May 2010, the article for the U.S. state of Washington was moved to [[Washington (U.S. state)]] and [[Washington]] was made a disambiguation page. This has caused most wikilinks to the state article to become ambiguous and need Wikipedia:Disambiguation relinking. (In addition, there may be occasional links to Washington that were mislinked in the first place.)
Regular expressions
editFor people with Wikipedia bots or tools that use regular expressions, here are regex patterns that may help you match ambiguous links that refer to the state of Washington (or to some other specific Washington article for that matter). Each expression has the match pattern followed by the replacement pattern, and assumes the regex implementation uses \1 for backreferences in the expression itself, but $1 for backreferences/substitution in the replacement.
Bot and tool owners: Check these first before doing a mass run, just in case any of these have bugs. (Feedback on which have succeeded on a dry run/mass run may be helpful also.)
These are in the format:
- Description
/regex/flags
replacement pattern
Based on explicit words that only mean the state
edit- "State of [[Washington]]" and the like — Note: Assumes Washington is a proper old link to the state; could also hit something like "state of Washington, D.C." or "state of Washington's mind" in a sentence in the unlikely event Washington was already improperly linked to begin with.
/([Ss])tate(s?) of \[\[Washington\]\]/g
$1tate$2 of [[Washington (U.S. state)|Washington]]
- [[Washington|something containing "state"]]
/\[\[Washington\s*\|\s*([^]]*state)/ig
[[Washington (U.S. state)|$1
- "[[Washington]] State" (be cautious, because "Washington State" is a disambiguation page, too; it can refer to the University)
/\[\[Washington\]\] ([Ss])tate\b/g
[[Washington (U.S. state)|Washington $1tate]]
- [[Washington|WA]] or [[Washington|Wa.]] or [[Washtington|Wa(sh). State]] — but not "[[Washington|Wash.]]" because that could be "Wash., D.C." or "Geo. Wash." or something
/\[\[Washington\s*\|\s*(W(?:[Aa](?:\.?|(?:sh(?:ington))\.? [Ss]tate))(\s+[^]]+)?)\s*\]\]/g
[[Washington (U.S. state)|$1]]
Based on unambiguous locations
edit- "[[Seattle]], [[Washington]]" in various forms — Seattle is one of the U.S. cities not requiring a state name on Wikipedia
/\[\[\s*Seattle(?:,? ?(?:WA|Washington)?(?:\|\s*Seattle\s*)?)?\]\], \[\[Washington\]\]/g
[[Seattle]], [[Washington (U.S. state)|Washington]]
- Locations linked as "[[Something, Washington|Something]], [[Washington]]"
/\[\[\s*([^]]+), W(?:A|ashington)\|\s*\1\s*\]\], \[\[Washington\]\]/g
[[$1, Washington|$1]], [[Washington (U.S. state)|Washington]]
Less-obvious location grouping
edit- some western state &/and/or some direction in [[Washington]] (common phrasing in geographic articles)
/((?:(?:Alask|British Columbi|Montan)a|Idaho|Oregon|Utah)(?:\]\])?\s+(?:&|and|or)\s+(?:(?:[Nn]or|[Ss]ou)th-?)?(?:(?:[Ee]a|[Ww]e)st)?ern)\s+\[\[Washington\]\]/g
$1 [[Washington (U.S. state)|Washington]]
Template-focused fixups
edit- disambiguate "Washington" in |*state*= parameters in templates, particular Geobox — one may want to manually make sure this is the result wanted for a given type of article
/(\|\s*\w+\s*state\d*\s*=\s*)(?:Washington|\[\[Washington\]\])(\s|\|)/g
$1[[Washington (U.S. state)|Washington]]$2
See also
edit- User:Closeapple/RMFset.js contains functions for use with meta:User:Pathoschild/Script:Regex menu framework, including functions involving Washington state cleanups. The functions start with the prefix rmfCa_washington.