Reputation: 150
I'm trying to do get some text between keywords into a text using regex. For example:
Text content:
Information Location
Porto Alegre
data data data data data data data data
Geolocation
If I use this regex (?:Information\sLocation\n.*\n)([\W\w]+)(?:Geolocation)
, I will get data data data .... It's fine! It's ok!
But, sometimes the text structure can be like this:
Information Location
Porto Alegre
data data data data data data data data
and my Regex fails! I've tried to find some way to put the last group (?:Geolocation) as optional , but I can't find a solution.
Upvotes: 1
Views: 47