Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1447.Text file parser -- How to split/parse lines into sentences outside two delimiters?

User: Aaron -- 2019-11-02          << 1446  1448 >>
Hits: 2395
Type: Text file parser   
Search all Text file parser examples
Description:
How to split/parse lines into sentences outside two delimiters? 
 
I would like to split lines into sentences only if they are outside two quotation marks. 
Lines delimited by two quotation marks remain unchanged.
Input Sample:
Fred stopped, took off his coat and hung it on the back of a chair. He looked like a soaking wet cat. He looked over toward where I was and added:  
"Dave isn't happy. I think the other man isn't looking too friendly either." I said: "That's not like Dave. I wouldn't worry about it."   
Fred's tone showed that he was more than worried. He had always believed Dave wasn't dangerous until today.
Output Sample:
Fred stopped, took off his coat and hung it on the back of a chair.  
He looked like a soaking wet cat.  
He looked over toward where I was and added:  
"Dave isn't happy. I think the other man isn't looking too friendly either."  
I said:  
"That's not like Dave. I wouldn't worry about it."   
Fred's tone showed that he was more than worried.  
He had always believed Dave wasn't dangerous until today.
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 'search for pattern' to: 
 
* set 'replace with pattern' to: 
 
3. click 'replace', done. 
Note,the pattern means adding \n for any of following cases: 
([^"]*?[\.\!\?]  means lines ends with .!? 
[^\n](?=") means " not preceeded by \n 
"[^"]*")\s* means anything enclosed by pair of ""

Screenshot 1:  Replace_Window


Similar Examples:
How to split one line into 3 to 5 sentences ended by period randomly? (61%)
How to split a single line into many lines, keep two words for each line? (61%)
How to split English sentence and Chinese sentence into different lines? (54%)
How to insert lines between sentences with specified order? (54%)
How to reverse order of sentence clauses and words delimited by specified chars? (54%)
How to make line by line sequential merge of multiple text files? (53%)
How to remove spaces inside and add spaces outside of quotation marks? (53%)
How to merge lines with identical first row in two files? (52%)

Check Demo of Text file parser
Keywords:
delimiters  quotation  anything  delimited  sentences  mark  quot  sentence  enclose  adding  replace with delimiters  replace delimiters  parser split file open source  only remain  replace sentences  two lines  split by lines  split file by lines