我有像下面這樣的段落。我只是想忽略文字[[drama film|film]]
。輸出應該是film
。 另一個例子[[Scotland|Scottish]]
輸出應該是Scottish
如果沒有Pipe
[伊娃·伯錫斯爾]然後輸出應該只有Eva Birthistle
想使用正則表達式分析段落
Ae Fond Kiss... (also known as ''Just a Kiss'') is a 2004 romantic [[drama film|film]]
directed by [[Ken Loach]], and starring [[Atta Yaqub]] and [[Eva Birthistle]]. The
title is taken from a [[Scotland|Scottish]] song by [[Robert Burns]], the complete
line being ''[[Ae Fond Kiss|Ae fond kiss]], and then we sever...'
Output I want
Ae Fond Kiss... (also known as ''Just a Kiss'') is a 2004 romantic film
directed by Ken Loach, and starring Atta Yaqub and Eva Birthistle. The
title is taken from a Scotland song by Robert Burns, the complete
line being 'Ae Fond Kiss, and then we sever...'
這可能嗎?
這裏是duplicate question。我在這方面嘗試過這個解決方案。但那個不起作用。我將非常感激。非常感謝。
你爲什麼要接受一個問題的答案,如果正則表達式是不工作?還有,它不起作用呢? – Wilduck
@Wilduck這是我的另一個問題。現在工作正常。用這個解決方案。 – Kulbir
在您的示例輸出中,'[[戲劇電影]]'變成'電影','[[蘇格蘭|蘇格蘭]]'變成'蘇格蘭'(與您的描述不符),'[[Ae Fond Kiss | Ae親吻]]'變成Ae親吻。你如何決定是否使用每個組的第一個或第二個元素? –