2
votes

I have this text that I want to capture

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. : $179720 (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.

I want to match every character between "Title" and "Abstract". I have try (?<=Title)(.)(?=Asbtract) and \bTitle\b(.?)\bAbstract\b, but didn't work. I can't figure out, what the correct syntax.

2
Actually, you need to specify your language. So, the regex will become very clear.Mayur Koshti
This is for java, thanksMuhammad Nur Akbar

2 Answers

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

. does not match newlines by default.So use s flag or [\s\S]

See demo.

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

0
votes

You should use the following regex:

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