Given an input string fooxxxxxxfooxxxboo
I am trying to write a regex that matches fooxxxboo
i.e. starting from the second foo till the last boo.
I tried the following
foo.*?boo
matches the complete string fooxxxxxxfooxxxboo
foo.*boo
also matches the complete string fooxxxxxxfooxxxboo
I read this Greedy vs. Reluctant vs. Possessive Quantifiers and I understand their difference, but I am trying to match the shortest string from the end which matches the regex i.e. something like the regex to be evaluated from back. Is there any way I can match only the last portion?