python regex: variable length of positive lookbehind assertion
Marko Rauhamaa
marko at pacujo.net
Wed Jun 15 10:33:54 EDT 2016
Jussi Piitulainen <jussi.piitulainen at helsinki.fi>:
> alister writes:
>
>> On Tue, 14 Jun 2016 20:28:24 -0700, Yubin Ruan wrote:
>>> Given a string like this:
>>>
>>> >>>string = "false_head <a>aaa</a> <a>bbb</a> false_tail \
>>> true_head some_text_here <a>ccc</a> <a>ddd</a> <a>eee</a>
>>> true_tail"
>>>
>>> I want to match the all the text surrounded by those "<a> </a>",
>>> [...]
>>
>> don't try to use regex to parse html it wont work reliably
>> [...]
>
> Nothing in the question indicates that the data is HTML.
And nothing in alister's answer suggests that.
Marko
More information about the Python-list
mailing list