Replace Pioneer Home
All Examples
Free Download
all
Advanced search and replace
Replace text in multiple files
Regular expression replace
Batch file rename
Batch download
Text file parser
Text file splitter
Html text generator
Search replace binary
Random word generator
Character count
Character encoding
Bin Hex Oct Dec converter
Text generator
RSS: Replace Pioneer Examples
370.Regular expression replace -- How to replace the last occurance of 'old' in every line with 'new'?
User:
editor -- 2009-12-19
Hits:
132
Type:
Regular expression replace
Search all
Regular expression replace
examples
Description:
There is a file containing many lines of text, and there are more than one occurance of 'old' in each line? How to only replace the last occurance of 'old' in each line with 'new'?
Answer:
Hint: You need to
Download and install "Replace Pioneer"
to finish following steps.
1. ctrl-o open source text file
2. ctrl-h open replace window
* set 'Replace scope' to 'Line'
* in search for pattern, fill:
old(?!.*?old)
in replace with pattern, fill:
new
3. click 'Replace', ok.
4. ctrl-s save the file.
Download Script:
scripts/370.rst.zip
Similar Examples:
How to replace the last occurance of some text like 'abc' to 'def' in a text file?
(61%)
How to replace the second character of every line to 4 in a text file?
(60%)
How to replace the second character of every line to 4 in multiple files?
(58%)
How to replace the characters in fixed position in each line?
(55%)
How to replace word 'abc' to 'def' in specified lines like 1-10,18,20?
(53%)
How to replace specific spaces into comma in each line of text file?
(52%)
How to rename files to the last 10 chars of 3rd line of file content?
(52%)
How to remove the first 10 characters of each line in text file?
(52%)
Check Demo of
Regular expression replace