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
378.Regular expression replace -- How to remove all lines that contains more than one word?
User:
editor -- 2009-12-30
<< 377
379 >>
Hits:
4043
Type:
Regular expression replace
Search all
Regular expression replace
examples
Description:
How to remove all lines that contains more than one word?
I want to remove all phrases that listed in a text word list, and keep the single word.
Input Sample:
hello
hello world
welcome
no problem
bye
Output Sample:
hello
welcome
bye
Answer:
Hint: You need to
Download and install "Replace Pioneer"
on windows platform to finish following steps.
1. ctrl-o open source text file that containing words.
2. ctrl-h open 'Replace' dialog:
* set 'Replace Unit' to 'Line'
* in search for pattern enter:
\w+\s+\w+
3. click 'Replace', all lines that has 2 words at least(matches \w+\s+\w+) will be removed.
4. ctrl-s save to target file
Download Script:
scripts/378.rst.zip
Screenshot 1: Replace_Window
Similar Examples:
How to remove all lines that contain one or more words in a list?
(77%)
How to remove all the lines that do not contain any of words in a list?
(75%)
How to delete/remove all lines that appearred more than once?
(74%)
How to remove all lines that shorter than 10 characters?
(72%)
How to extract all lines that has more than 2 numbers?
(71%)
How to delete all lines that contain only a word and a blank?
(70%)
How to remove all lines that are not ended with word "ok" or "done"?
(67%)
How to remove lines that contain some words base on percentages?
(66%)
Check Demo of
Regular expression replace
Keywords:
phrases
matches
phrase
more than
keep
contains
remove all lines
word list
containing
remove all line
search file for lines containing all words
remove all lines contains
keep lines containing
remove lines more than
keep 2 words
keep words
remove lines more
keep lines