Jump to content

User:NYKevin/Regex

From Wikipedia, the free encyclopedia

I've decided to compile a list of useful regexes for use with wikEd. Please add to this. As far as I can tell, these are POSIX regexes.

Warning: Never apply these without checking the output!

[^A-Za-z0-9{-]+sic[^A-Za-z0-9}-]+
replace with " {{sic}} "

this will replace things like [sic] with [sic]. Will not detect -sic- or <!--sic--> (will still detect <!-- sic -->, but not <!--sic --> or the like). The latter is deliberate, the former is an unintended side effect whose impact should be minimal, and which would be very difficult to look for

<(em|i|strong|b)>.*</(em|i|strong|b)>
must be manually replaced with ''...'' or '''...''' as appropriate

Detects <i>, <em>, <strong>, and <b> and their closing tags. The first two make italics, the last two make bolds. In theory wikEd can do this on its own, but Cacycle discourages using those functions across the entire text. They might be used locally, once you have found the problems using this regex. The fix button looks like a pair of angled brackets (<>).