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
Count and statistics
Character encoding
Bin Hex Oct Dec converter
Text generator
Text sort
Text merge
Text data calculation
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
<< 369
371 >>
Hits:
361
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"
on windows platform 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
Screenshot 1: Replace_Window
Similar Examples:
How to replace the last occurance of some text like 'abc' to 'def' in a text file?
(61%)
How to replace the first 3 spaces into comma in each line of text?
(60%)
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 2nd and 3rd occurrences of some words in multiple files?
(57%)
How to replace the characters in fixed position in each line?
(55%)
How to replace each xxx with the first word in the same line in text file?
(54%)
How to replace all numbers 93 in every line that contains gas?
(54%)
Check Demo of
Regular expression replace
Keywords:
occurance
every line
containing
last
every
scope
replace scope
regular expression
las
ran
lines to new file
lines containing
last line
line last
each line new file
only search text
more replace
replace old new