Let\'s say I have the following string:
this is a test for the sake of testing. this is only a test. The end.
and I want to se
* is a greedy quantifier. That means it matches as much as possible, i.e. what you are seeing. Depending on the specific language support for regex, you will need to find a non-greedy quantifier. Usually this is a trailing question mark, like this: *?. That means it will stop consuming letters as soon as the rest of the regex can be satisfied.
There is a good explanation of greediness here.