Topic on Manual talk:Pywikibot

Replace the whole text

5
Aschroet (talkcontribs)

Is there any script i can use to replace the whole wiki text of a page? I only found replace.py which replaces a list of words or add_text.py which can add texts to the existing one. Has somebody a hint for me?

Xqt (talkcontribs)

replace.py could do it:

pwb.py replace -regex ".*" "Any text you want to have on this page" -page:user:Aschroet/sandbox

Xqt (talkcontribs)

Better use:

pwb.py replace -regex "(?s).+" "Any text you want to have on this page" -page:user:Aschroet/sandbox

Aschroet (talkcontribs)

Thank you. A batch replacement is not possible, or?

Xqt (talkcontribs)

For small text you may use -pairsfile. Another ideas is using fixes. You have to modify your user-fixes.py for replacement.

I think the best script would be using pagefromfile.py; refer -help for mor Information about that.

Reply to "Replace the whole text"