I have sentences within text I need to extract. They are formatted as such:
Less word word....etc Number% (<-- eg. 99%)
OR
More word word etc Number%
I would like to create a regular expression that will capture everything between the word Less or the word More and the ending percentage sign.
The challenge I'm having is that I cannot use the ^ or the $ characters as these sentences don't start with a new line.
Is there a way to signify that I'd like to capture ech instance of SENTENCES (not lines) beginning with:
(less | more)
and ending with:
%
To clarify - I want to include Less and More and the percent symbol in what I'm capturing.
Here is what I have so far:
(?=Less|More)(.*)((\%|\s\bpercent\b))
The above code captures the first instance of the word 'Less' and everything after it. I would like every sentence to be captured separately.
For example, the two sentences below should be captured separately:
Less than a dollar 99,5%
More than a dollar and less than a cent 95%
EDIT FOR CLARIFICATION:
What I'm after is a solution that won't capture the ENTIRE text below.
More than 55 percent RANDOM STRING. RANDOM STRING. Less than a dollar 99,5% More than a dollar and less than a cent 95%
My aim is to capture three sentences from the above string, preferably all in one group:
More than 55 Percent
Less than a dollar 99,5%
More than a dollar and less than a cent 95%