I have been using " -exceptinsidetag:header" with replace.py. This was added by Daniel Herding in response to a request by me:
This will exclude wikilinks and URLs. There are some more things that can be
excluded, see the source code of the method replaceExcept() in wikipedia.py
(look at the exceptionRegexes dictionary). I have just added a regular
expression for section headers for you, so if you're running the SVN version,
you can use this parameter:
-exceptinsidetag:header