正则表达式匹配文档中两个字符串之间的所有字符

Regex Match all characters between two strings in documents

我有这段文字要截取

Title : CRB: Genetic Diversity of Endangered Populations of Mysticete Whales: Mitochondrial DNA and Historical Demography Type : Award NSF Org : DEB Latest Amendment Date : August 1, 1991 File : a9000006

Award Number: 9000006 Award Instr.: Continuing grant
Prgm Manager: Scott Collins
DEB DIVISION OF ENVIRONMENTAL BIOLOGY
BIO DIRECT FOR BIOLOGICAL SCIENCES Start Date : June 1, 1990 Expires : November 30, 1992 (Estimated) Expected Total Amt. : 9720 (Estimated) Investigator: Stephen R. Palumbi (Principal Investigator current) Sponsor : U of Hawaii Manoa 2530 Dole Street Honolulu, HI 968222225 808/956-7800

NSF Program : 1127 SYSTEMATIC & POPULATION BIOLO Fld Applictn: 0000099 Other Applications NEC
61 Life Science Biological Program Ref : 9285, Abstract :

          Commercial exploitation over the past two hundred years drove                  
          the great Mysticete whales to near extinction.  Variation in                   
          the sizes of populations prior to exploitation, minimal                        
          population size during exploitation and current population                     
          sizes permit analyses of the effects of differing levels of                    
          exploitation on species with different biogeographical                         
          distributions and life-history characteristics.  Dr. Stephen                   
          Palumbi at the University of Hawaii will study the genetic                     
          population structure of three whale species in this context,                   
          the Humpback Whale, the Gray Whale and the Bowhead Whale.  The                 
          effect of demographic history will be determined by comparing                  
          the genetic structure of the three species.  Additional studies                
          will be carried out on the Humpback Whale.  The humpback has a                 
          world-wide distribution, but the Atlantic and Pacific                          
          populations of the northern hemisphere appear to be discrete                   
          populations, as is the population of the southern hemispheric                  
          oceans.  Each of these oceanic populations may be further                      
          subdivided into smaller isolates, each with its own migratory                  
          pattern and somewhat distinct gene pool.  This study will                      
          provide information on the level of genetic isolation among                    
          populations and the levels of gene flow and genealogical                       
          relationships among populations.  This detailed genetic                        
          information will facilitate international policy decisions                     
          regarding the conservation and management of these magnificent                 
          mammals.

我想匹配“Title”和“Abstract”之间的每个字符。我试过 (?<=Title)(.)(?=Asbtract)\bTitle\b(. ?)\bAbstract\b,但没有用。我不知道正确的语法是什么。

\bTitle\b([\s\S]*?)\bAbstract\b

. 不匹配 newlines 通过 default.So 使用 s 标志或 [\s\S]

查看演示。

https://regex101.com/r/lR1eC9/6

您应该使用以下正则表达式:

Title\s*\:(.*?)Abstract\s*\: