Pixel People Wiki
Advertisement

Webchickenator Webchickenator 15 August 2013
0

Using regular expression find/replace to clean up Wiki syntax

I sat down to edit the Professions page in "Source" mode and encountered a bit of a mess, so set out to clean it up. You can view the diff here, if you're curious: http://pixelpeople.wikia.com/index.php?title=Professions&diff=12435&oldid=12430 A lot of this was simple find/replace.

However, the trickiest thing was taking markup like this:


This means take the *first* group of parentheses it encounters and stick whatever's in between them (in our case, the human readable name of the wiki link) between double brackets. If we had put parentheses around, say, the URL part as well, we would refer to that as $1 (because it comes first) and the human-readable version would be $2, and so on.

And... voila! :)

Read Full Post

Advertisement