Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

722.Regular expression replace -- How to remove any comments that from hash mark "#" to line end?

User: editor -- 2011-02-20          << 721  723 >>
Hits: 4842
Type: Regular expression replace   
Search all Regular expression replace examples
Description:
How to remove any comments that from hash mark "#" to line end? 
Any comments are started from #, and ended until line end
Input Sample:
line1 # comments of line1 
line2 
#comments of line3 
line4 
line5 # comments of line5
Output Sample:
line1  
line2 
 
line4 
line5  
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open source file 
2. ctrl-h open replace dialog 
* set 'replace unit' to 'Chars' 
* set 'replace scope' to 'Line' 
* set 'search for pattern' to: 
 
3. click 'replace', ok 
4. ctrl-s save to file.

Screenshot 1:  Replace_Window


Similar Examples:
How to remove all c++ comments that started with //? (65%)
How to remove the timestamps at the start of line in lrc files? (59%)
How to remove content from the last interpunction to line end? (58%)
How to remove commas and replace with a single space? (54%)
How to remove duplicate column in each line? (54%)
How to remove all lines that contains more than one word? (54%)
How to delete lines that start with duplicate text? (53%)
How to remove everything between the products and the last slash in each line? (53%)

Check Demo of Regular expression replace
Keywords:
comments  mark  replace scope  scope  regular expression  expression  line end  chars  regular  regula  line started to end  line started end  remove comments  remove from to end  remove line end  remove line from  from to end  remove from