Golang - 使用正則表達式提取鏈接我需要example.de在 Go 中使用 Regex從特定域中的文本獲取所有鏈接以下是應提取的所有可能鏈接:https://example.de
https://example.de/
https://example.de/home
https://example.de/home/
https://example.de/home some text that should not be extracted
https://abc.example.de
https://abc.example.de/
https://abc.example.de/home
https://abc.example.de/home
https://abc.example.de/home some text that should not be extracted我已經嘗試過的我使用這個網站來檢查我的正則表達式是否正確: https ://regex101.com/r/ohxUcG/2 以下是失敗的組合:https?://*.+example.de*.+表達失敗,https://abc.example.de/a1b2c3 dsadsa將整個文本轉移到\n而不是https://abc.example.de/a1b2c3沒有dsadsahttps?://*.+example.de*.+\s(\w+)$這會獲取僅以空格終止的鏈接,但有時鏈接可以以\n或\t等終止。
Golang - 使用正則表達式提取鏈接
慕尼黑8549860
2022-12-13 16:09:32