I'm trying to remove all characters (including newlines) between two given substrings, using R's gsub("regexp", "", string, perl=T) (i.e. replace all matches with the empty string). 
What I have so far is the regular expression (?<=A)(?s:.)+(?=B) where I use the s modifier to make the . match newline also. The problem is that when there are multiple occurences of the lookahead B, I only want to remove whatever lies between A and the first B:
I have A remove \r\n this B but leave this B 
I want AB but leave this B
but so far what I get is AB 
How can I modify the regex to make the lookahead stop at the first occurence?
 
     
    