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
535.Regular expression replace -- How to replace the all word "test" with the first word in same line?
User:
editor -- 2010-06-14
<< 534
536 >>
Hits:
313
Type:
Regular expression replace
Search all
Regular expression replace
examples
Description:
How to replace the all word "test" with the first word in same line?
Input Sample:
word1 ... test
word2 ...... test ...
word3 ..... test .......
...
Output Sample:
word1 ... word1
word2 ...... word2 ...
word3 ..... word3 .......
...
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 unit" to "line"
* set "Replace with Pattern" entry to:
replace($match,'^((\w+).*?)test','\1\2')\n
3. click "Replace", done!
Similar Examples:
How to replace each xxx with the first word in the same line in text file?
(68%)
How to replace all the numbers in a text file to the square value?
(61%)
How to replace the same words in text files with different strings?
(60%)
How to batch rename files with the first word of file contents?
(60%)
How to replace the characters in fixed position in each line?
(60%)
How to delete all lines whose first word appeared in previous line?
(59%)
How to delete the first word in each line in a text file?
(59%)
How to split a text file according to first word in each line?
(58%)
Check Demo of
Regular expression replace
Keywords:
first word
test
same
regular expression
expression
first
rst
regula
regular
word
replace same word
line test
test test test test
first replace line
replace first line
the first line
first line
replace first