如何設計一個正則表達式來捕獲兩個字符串之間的所有字符? 具體來說,從這個大的字符串:正則表達式返回兩個字符串之間的所有字符
Studies have shown that...[^title=Fish consumption and incidence of stroke: a meta-analysis of cohort studies]... Another experiment demonstrated that... [^title=The second title]
我想[^title=
和]
之間提取所有的字符,也就是說,Fish consumption and incidence of stroke: a meta-analysis of cohort studies
和The second title
。
我想我將不得不使用re.findall(),而且我可以這樣開始:re.findall(r'\[([^]]*)\]', big_string)
,這會給我所有的方括號[ ]
之間的比賽,但我不知道如何擴展它。