import re regtitlepreprocess = re.compile(r'
([^<]*)
',re.MULTILINE | re.DOTALL) regdeflist = re.compile(r'(\n;[^:\n]*:)') regsentinitialbracket = re.compile(r'([^M][^rs]\.)\s+(\[\[([^|\]]+\|)?([A-Z])([^|\]]+)\]\])',re.MULTILINE | re.DOTALL) regneosfirst = re.compile(r'()+\s*()+\s*()*\s?', re.MULTILINE | re.DOTALL) regneosfinal = re.compile(r'()*\s*()+\s*()+\s?', re.MULTILINE | re.DOTALL) regneosremove = re.compile(r'', re.MULTILINE | re.DOTALL) regeos = re.compile(r'\s?', re.MULTILINE | re.DOTALL) regeosTwoOrMore = re.compile(r'((\s*)|(\s?\n)){3-10}', re.MULTILINE | re.DOTALL) regredirect = re.compile(r'#[rR][eE][dD][iI][rR][eE][cC][tT]\s?\[\[([^\]]+)\]\]', re.MULTILINE | re.DOTALL ) regcurly1 = re.compile(r'(\({{[^}^{]*?}}\)|\'*{{[^}^{]*?}}\'*)', re.MULTILINE | re.DOTALL) regwikitable1 = re.compile(r'{[^}]*?class="?wikitable"?[^}]*?}', re.MULTILINE | re.DOTALL) regwikitable2 = re.compile(r'[^{]{\|[^\\][^}^{]*?}', re.MULTILINE | re.DOTALL) regtablehardcode = re.compile('{\|\sclass=\"wikitable\"\s!English\s\|\|\sFrench\s\|\|\sIPA pronunciation\s\(Canadian accent\).*?\|}', re.MULTILINE | re.DOTALL) regeos = re.compile(r'\s?', re.MULTILINE | re.DOTALL) regbr = re.compile(r'', re.MULTILINE | re.DOTALL) regref = re.compile(r'<[Rr]ef.*?/[Rr]ef>', re.MULTILINE | re.DOTALL) regref2 = re.compile(r'<[Rr]ef[^>]*?/>', re.MULTILINE | re.DOTALL) regcomment = re.compile(r'', re.MULTILINE | re.DOTALL) regblockquote = re.compile(r'(.*?)',re.MULTILINE | re.DOTALL) regsource = re.compile(r'',re.MULTILINE | re.DOTALL) regdiv2 = re.compile(r']*?>',re.MULTILINE | re.DOTALL) reggallery = re.compile(r'',re.MULTILINE | re.DOTALL) regsingleast = re.compile(r'^\*$') reghyphen = re.compile(r'----?',re.MULTILINE | re.DOTALL) regcenter = re.compile(r'',re.MULTILINE | re.DOTALL) regsealso = re.compile(r'==+\s?See also\s?==.*', re.MULTILINE | re.DOTALL) regnotes = re.compile(r'==+\s?Notes\s?.*', re.MULTILINE | re.DOTALL) regreferences = re.compile(r'==+\s?References.*', re.MULTILINE | re.DOTALL) regsources = re.compile(r'==+\s?Sources.*', re.MULTILINE | re.DOTALL) regsourcelookahead = re.compile(r'==+\s?(?=Sources.*?==+\s?Sources)', re.MULTILINE | re.DOTALL) regseealsolookahead = re.compile(r'==+\s?(?=See also.*?==+\s?See also)', re.MULTILINE | re.DOTALL) regnoteslookahead = re.compile(r'==+\s?(?=Notes.*?==+\s?Notes)', re.MULTILINE | re.DOTALL) regreflookahead = re.compile(r'==+\s?(?=References.*?==+\s?References)', re.MULTILINE | re.DOTALL) regsourcelookaheadrestore = re.compile(r'___(Sources)(.*?==+)',re.MULTILINE | re.DOTALL) regnoteslookaheadrestore = re.compile(r'___(Notes)(.*?==+)',re.MULTILINE | re.DOTALL) regreflookaheadrestore = re.compile(r'___(References)(.*?==+)',re.MULTILINE | re.DOTALL) regseealsolookaheadrestore = re.compile(r'___(See also)(.*?==+)',re.MULTILINE | re.DOTALL) regbibliography = re.compile(r'==+\s?Bibliography\s?.*', re.MULTILINE | re.DOTALL) regfootnotes = re.compile(r'==+\s?Footnotes\s?.*', re.MULTILINE | re.DOTALL) regrelated = re.compile(r'==+\s?Related web sites\s?.*', re.MULTILINE | re.DOTALL) regexternal = re.compile(r'==+\s?External links\s?.*', re.MULTILINE | re.DOTALL) regmath = re.compile(r'[^\>]+?',re.MULTILINE | re.DOTALL) regremovenewline = re.compile(r'(?=\n)\n',re.MULTILINE | re.DOTALL) regparagraph = re.compile(r'(\n\n)',re.MULTILINE | re.DOTALL) regtitle = re.compile(r'(==+?\s?[^=]+?\s?==+\s?)',re.MULTILINE | re.DOTALL) regbullets = re.compile(r'(^[#*].*?)\n', re.MULTILINE | re.DOTALL) regbulletscolon = re.compile(r'(?<=([\.:]\s))([*#].*?)\n') regbullets2 = re.compile(r'(^\*.*?)\n', re.MULTILINE | re.DOTALL) regindentcolon = re.compile(r'(^[;:][:;]?.*?)\n', re.MULTILINE | re.DOTALL) regcolon = re.compile(r'^:', re.MULTILINE | re.DOTALL) regimage = re.compile(r'\[\[Image:[^\[\]]*(\[\[[^\]]*\]\][^\[\]]*)*?\]\]',re.MULTILINE | re.DOTALL) regspan = re.compile(r'',re.MULTILINE | re.DOTALL) regbracket = re.compile(r'(\[\[([^|\]]+\|)?([^|\]]+)\]\]s\.)',re.MULTILINE | re.DOTALL) regjava = re.compile(r'{{(Javadoc:.*?)}}',re.MULTILINE | re.DOTALL) regiast = re.compile(r'{{(IAST.*?)}}',re.MULTILINE | re.DOTALL) regipa = re.compile(r'{{(IPA.*?)}}(?=[^}])', re.MULTILINE | re.DOTALL) regyeareos = re.compile(r'([0-9]{2,4}s\.)', re.MULTILINE | re.DOTALL) regorg = re.compile(r'(\.org\.\s)', re.MULTILINE | re.DOTALL) ##japanese regtransjap = re.compile(r'{{transl\|ja\|([^}]*?)}}', re.MULTILINE | re.DOTALL) reglangjap = re.compile(r'{{lang\|ja\|([^}]*?)}}', re.MULTILINE | re.DOTALL) regnihongohardcode = re.compile(r'({{Nihongo\|[^|]+\|[^|]+\|)3=',re.MULTILINE | re.DOTALL) regnihongojap5 = re.compile(r'{{[Nn]ihongo\|([^|}]+)\|([^|}]+)\|([^|}]+)\|([^|}]+)\|([^|}]+)}}', re.MULTILINE | re.DOTALL) regnihongojap4 = re.compile(r'{{[Nn]ihongo\|([^|}]+)\|([^|}]+)\|([^|}]+)\|([^|}]+)}}', re.MULTILINE | re.DOTALL) regnihongojap3 = re.compile(r'{{[Nn]ihongo\|([^|}]*?)\|([^|}]*?)\|([^|}]+)}}', re.MULTILINE | re.DOTALL) regnihongojap2 = re.compile(r'{{[Nn]ihongo\|([^|}]+)\|([^|}]+)\|?}}', re.MULTILINE | re.DOTALL) regbacktocurly1 = re.compile(r'<___', re.MULTILINE | re.DOTALL) regbacktocurly2 = re.compile(r'___>', re.MULTILINE | re.DOTALL) regremoveeosinmath = re.compile(r'((.*)*?(.*?)', re.MULTILINE | re.DOTALL) regremoveeosinsource = re.compile(r'((.*)*?(.*?)', re.MULTILINE | re.DOTALL) regremoveeosinsource2 = re.compile(r'()', re.MULTILINE | re.DOTALL) regremoveeosincode2 = re.compile(r'()', re.MULTILINE | re.DOTALL) regremoveeosincode = re.compile(r'((.*)*?(.*?)', re.MULTILINE | re.DOTALL) regremoveeosinnowiki = re.compile(r'((.*)*?(.*?)', re.MULTILINE | re.DOTALL) #regdigitandbold = re.compile(r'(^:"[0-9][0-9]\.\s+(?=\'))', re.MULTILINE | re.DOTALL) #regcurly1 = re.compile(r'{{?[^}^{]*?}?}', re.MULTILINE | re.DOTALL) #regsource1 = re.compile(r'