第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Golang - 使用正則表達式提取鏈接

Golang - 使用正則表達式提取鏈接

Go
慕尼黑8549860 2022-12-13 16:09:32
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等終止。
查看完整描述

1 回答

?
森林海

TA貢獻2011條經驗 獲得超2個贊

您可以使用

(?:https?://)?(?:[^/.]+\.)*\bexample\.de\b(?:/[^/\s]+)*/?

請參閱正則表達式演示。詳情

  • (?:https?://)?- 一個可選的http://https://字符串

  • (?:[^/.]+\.)* - 一個或多個字符的零個或多個序列,除了 a/.chars,然后是.char

  • \bexample\.de\b- 一個完整的詞example.de

  • (?:/[^/\s]+)*- 零次或多次重復/,然后是除空格以外的一個或多個字符,以及/

  • /?- 一個可選的/字符。


查看完整回答
反對 回復 2022-12-13
  • 1 回答
  • 0 關注
  • 239 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號