I am finding it a bit difficult to wrap my head around prefix and suffix lookups in regular expressions. I am practicing and want to do the following:
Given a string: "James is good". I want to be able to match the maximal substring in-order, i.e get a match if the text is "James"or "James is" or "James is good". So if I have the following text: "James James is James", I should be able to capture "James is" and not just "James". Simalrly " is James James is Good James" should give me "James is Good" and not "is James" as it is out of order and not maximal
I think i can use suffix is not present(?!), to match, say only "James" if "is good" is not present and so on, but I am not sure if I understand the concept of prefix and suffix matching correctly.
Any clarification or help in this case would be great. I tagged java because I am familiarizing myself with java's regex api.