Advanced Search and Replace

replace_demo  Replace_text_in_multiple_files 
Advanced Search and Replace Features:
* Supports regular expression and multiple line search and replace
* Can search and replace text in multiple files
* Can add,delete,insert text or cut and reorganize the matched strings
* Can apply variables like "line_no" or "word_no" on the matched strings
* Can apply functions like "reverse","uc(uppercase)","sort" on the matched strings
* Can replace whole word,line or paragraph that containing searched strings
* Can make multiple search and replace in one time by providing multiple rules
* Every operation is automatically recorded into script, can modify and re-use

Column Exchange - Advanced Search and Replace

Example

Reverse order the 2,3,4,5 words of each line.

Advanced search and replace

Procedures:

1) ctrl-o open source text file

2) ctrl-h open 'replace' dialog

3) set 'Replace Unit' to 'Line'

4) set 'Replace with pattern' to '$match[1,5,4,3,2,6..]'

5) click 'Replace', the column 1,2,3,4,5,6 will be changed to 1,5,4,3,2,6


Line Merge - Advanced Search and Replace

Example

Join every 3 lines into one line

Advanced search and replace

Procedures:

1) ctrl-o open source text file

2) ctrl-h open 'replace' dialog

3) set 'Unit number filter' to '!3<3>'

4) set 'Search for pattern' to '\n'(\n means newline)

5) set 'Replace with pattern' to nothing

6) click 'Replace', all line breaks except 3,6,9,12,... will be removed

Notes:

3<3> means 3,6,9,12,...(start from 3, step is 3).

!3<3> means 1,2,4,5,7,8,10,11,(not 3,6,9,12,15,...)

Advanced Text Sort - Advanced Search and Replace

Example

Sort all lines by the value of second word

Procedures:

1) ctrl-o open source text file

2) ctrl-h open 'replace' dialog

3) set 'Replace with pattern' to "sort_by_word($match,2,2,'num')"

4) click 'Replace', all lines will be sorted by the value of second word

Example

Sort all words by the length

Procedures:

1) ctrl-o open source text file

2) ctrl-h open 'replace' dialog

3) set 'Replace with pattern' to "join(' ',sort { length($a)<=>length($b) } split(' ',$match))"

4) click 'Replace', the text will be sorted by the value of second word

Notes:

For batch replace files, please refer to Replace Pioneer help manual.


Other Examples of "Advanced search and replace"
How to replace date format YYMM with the YYMM01 of next month?
How to insert a separator before the first Chinese char in each line?
How to replace the quoted text with lines from another file?
How to remove all lines that can be found in another file?
How to add a <hr> at the end of each paragraph?
How to generate several different versions of shuffled paragraphs?
How to randomly generate some of the permutation of paragraphs?
How to generate permutation of all paragraphs?

Search all "Advanced search and replace" examples