DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:strreplace

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:strreplace [2013-06-12 22:44] – [Examples] turnermmplugin:strreplace [2020-02-05 05:58] (current) – Version upped Aleksandr
Line 3: Line 3:
 ---- plugin ---- ---- plugin ----
 description: Does search and replace on up to 4 strings when file is loaded into the editor description: Does search and replace on up to 4 strings when file is loaded into the editor
-author     :  Myron turner +author     : Myron Turner 
-email      :  turnermm02@shaw.ca +email      : turnermm02@shaw.ca 
-type       :  +type       : action 
-lastupdate : 2013-06-11 +lastupdate : 2019-10-08 
-compatible :adora belle, weatherwax+compatible : adora belle, weatherwax,hrun,detritus,Greebo
 depends    :  depends    : 
 conflicts  conflicts 
 similar    :  similar    : 
-tags       : +tags       : regexp, search, replace, text, replace, string
  
-downloadurl:  https://github.com/turnermm/strreplace/archive/master.zip +downloadurl: https://github.com/turnermm/strreplace/archive/master.zip 
-bugtracker :  http://github.com/turnermm/strreplace/issues +bugtracker : https://github.com/turnermm/strreplace/issues 
-sourcerepo :  http://github.com/turnermm/strreplace/ +sourcerepo : https://github.com/turnermm/strreplace 
-donationurl: +donationurl: http://mturner.org/userfiles/donate.php 
  
 screenshot_img :  screenshot_img : 
Line 24: Line 24:
 ===== Installation ===== ===== Installation =====
  
-Install the plugin using the [[plugin:plugin|Plugin Manager]] and the download URL above, which points to latest version of the plugin. Refer to [[:Plugins]] on how to install plugins manually.+Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
  
 ===== Usage ===== ===== Usage =====
- 
  
 Enter up to four strings and their replacements in the Configuration Manager.  Then set the 'do_replace' Enter up to four strings and their replacements in the Configuration Manager.  Then set the 'do_replace'
Line 36: Line 35:
  
 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 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 Search and Replace Session ====
  
 The plugin keeps track of the pages which it has processed and will not re-process the same page twice 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|Configuration Options]] below. 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|Configuration Options]] below.
- 
- 
  
 ==== Examples ==== ==== Examples ====
 +
 Regular expressions must be bracketed by hashes: Regular expressions must be bracketed by hashes:
    #regex#    #regex#
Line 54: Line 53:
  
 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. 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.
 +
 ===== Configuration Options ===== ===== Configuration Options =====
 +
 |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. ''strreplace'' keeps a list of the files it has processed. If this option is set to false after ''strreplace'' has been active, the list will be deleted.  When it is re-set to true, a new [[#the_search_and_replace_session|session]] will be activated and all files will be re-processed.| |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. ''strreplace'' keeps a list of the files it has processed. If this option is set to false after ''strreplace'' has been active, the list will be deleted.  When it is re-set to true, a new [[#the_search_and_replace_session|session]] will be activated and all files will be re-processed.|
 |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 [[#the_search_and_replace_session|current session]] remains in effect.|  |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 [[#the_search_and_replace_session|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 [[#the_search_and_replace_session|session]]. | +|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 [[#the_search_and_replace_session|session]]. However, only pages which have not already been processed will be affected by the new setting.|
 |search_2| Search Term 2|  |search_2| Search Term 2|
 |search_3 |Search Term 3|  |search_3 |Search Term 3|
Line 65: Line 66:
 |replace_3 |Replacement 3|  |replace_3 |Replacement 3|
 |replace_4| Replacement 4| |replace_4| Replacement 4|
 +
 +===== Changes =====
 +{{rss>https://github.com/turnermm/strreplace/commits/master.atom date coount=10}}
 +===== Discussion =====
 +
 +==== 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?
 +
 +For example:
 +''this is a test<code php>'' \\
 +should be replaced into \\
 +''this is a test'' \\
 +''<code php>'' \\
 +> 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: %%\\\\%%.  --- [[user>turnermm|Myron Turner]] //2014-07-25 16:48//
 +
  
plugin/strreplace.1371069850.txt.gz · Last modified: 2013-06-12 22:44 by turnermm

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki