Replace Pioneer Home   All Examples   Free Download

 New request --free  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: 532
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:

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 remove all lines that are not ended with word "ok" or "done"? (67%)
How to extract all lines that containing ABC or DEF with original order? (66%)
How to extract all lines that has more than 4 columns from csv file? (65%)

Check Demo of Regular expression replace
Keywords:
matches  word list  keep  containing  remove all line  single  regular expression  expression  get  regular  keep 2 words  keep words  remove all lines containing  replace a single word  more word  remove words  lines containing  remove word