I'm trying to wrap my head around regular expressions, and still can't figure one thing out.
Let's say we have this string:
const text = 'The quick brown fox jumps over the lazy dog. If the dog reacted, was it really lazy?'
If I use text.match(/(dog)([^]+)(lazy)/)
, it gives me dog. If the dog reacted, was it really lazy"
.
Instead I'm trying to get something like this: "dog reacted, was it really lazy"
.
How do I format the regular expression, to get the shortest match between the first and the second word?