With the regex pattern (Python):
(?<=start<).*?(?=>end)
I'd like to match/select only the most internal text of the following string:
start< obj1 obj2 start< obj3 >end
that is:
obj3
I use Pythex as online regex tester for my code (link). Pythex returns
obj1 obj2 start< obj3
instead of
obj3
Do you know a way to force the match of the most internal text? Maybe with some extra python code (if it is impossible with regex alone)?
Thanks
UPDATE 01 Sorry, I've tested your solutions (all) with different kinds of strings but I can't obtain what I want that is: match all between "start<" and ">end" but excluding strings containing "start<" and other characters before "start<".
For example if I have the string
start< obj1 >end start< obj2 >end start< obj3 start< obj4 >end
where "obj4" is equal to "<" (for example), no method/pattern proposed works because no method can match "<" at the end of the string. For the string above I'd like to obtain the following matched text (findall):
- obj1
- obj2
- obj3
- <
regardless of what "obj4" is (so the method I'm searching should work in general also if obj# is equal to "<").
Can you suggest some other solutions?
Thank you