Table of Contents
Compatible with DokuWiki
- 2020-07-29 "Hogfather" unknown
- 2018-04-22 "Greebo" yes
- 2017-02-19 "Frusterick Manners" unknown
- 2016-06-26 "Elenor Of Tsort" unknown
This plugin will do a search and replace on up to four strings set in the Configuration Manager. It works transparently in the background. When the user opens the file in the editor, the new string is in place. When the file is saved the replacement becomes permanent.
Enter up to four strings and their replacements in the Configuration Manager. Then set the 'do_replace' option to true. When the page is loaded into the editor the plugin will do the search and replace.
The Search and Replacement strings are numbered 1-4. The Search strings may be regular expressions as described below in the examples section.
The replacements are done in the editor when the page is loaded for editing. But the plugin understands
Cancel and the changes will not become permanent unless the page is saved.
The Search and Replace Session
The plugin keeps track of the pages which it has processed and will not re-process the same page twice during the same search and replace session. A session remains in effect for as long as the 'do_replace' option is set to true. To start a new session, set the 'do_replace' option to false, save the updated configuration, then reset it to true and re-save. Processing can also be suspended. See Configuration Options below.
Regular expressions must be bracketed by hashes:
They can include PCRE internal options, though not all are guaranteed to work; you will have to test. All searches include the 'ms' options by default, but (?i) will set case insensitivity.
All will result in **Number**. But example 2 will also replace
Newer, while example 3 will replace both
never by **Number**. Regular expressions should be used with care.
Also, it might be useful in some cases to know that the substitutions are done in order, that is,
Search Term 1,
Search Term 2, etc.
|do_search||To do a search and replace, set this option to true. For each Search Term enter a Replacement at the same numbered position.
|suspend||When set to true this option temporarily suspends the search and replace processing. This does not affect the list of previously processed files. The current session remains in effect.|
|search_1||Search Term 1: the search string entered here is replaced by Replacement 1, etc. Search terms and their replacements can be set at any time, even during an active session. However, only pages which have not already been processed will be affected by the new setting.|
|search_2||Search Term 2|
|search_3||Search Term 3|
|search_4||Search Term 4|
- Merge pull request #10 from dokuwiki-translate/lang_update_1430_15765… (2019-12-17 15:43)
- translation update (2019-12-17 09:00)
- Merge pull request #9 from dokuwiki-translate/lang_update_1385_157228… (2019-10-29 22:22)
- translation update (2019-10-28 20:05)
- update info (2019-10-08 20:28)
- Merge pull request #8 from dokuwiki-translate/lang_update_1354_157055… (2019-10-08 20:24)
- translation update (2019-10-08 20:10)
- Merge pull request #7 from dokuwiki-translate/lang_update_899_1530791924 (2018-07-05 15:12)
- translation update (2018-07-05 14:00)
- Merge branch 'master' of github.com:turnermm/strreplace (2018-05-24 14:53)
Replace word into same word but on a new line
Is it possible to search on the word '<code' that is not starting at the beginning of a new line and replace it by '<code' but on a new line?
this is a test<code php>
should be replaced into
this is a test
The plugin only accepts valid dokuwiki syntax, so there is no way to insert a newline. You can, however, insert the dokuwiki markup for the newline, which is the double backslash; however, to get the double backslash you must enter four backslashes in the replacement string, since each backslash must be escaped: \\\\. — Myron Turner 2014-07-25 16:48