Let's say I'm trying to match /dog.*lab/
against this text:
"I have a dog. My dog is a black lab. He was created in a laboratory."
Greedily, it would match "dog. My dog is a black lab. He was created in a lab".
I want to find the smallest possible match from both sides. If I use the ungreedy modifier like
/dog.*?lab/
or /dog.*lab/U
it will match less but still too much:
"dog. My dog is a black lab"
Is there a way to make my search ungreedy from the left also, thus matching only "dog is a black lab"?
Much thanks. Sorry for the contrived example.