2016-04-17 59 views

回答

1
https?:\/\/([^@]+).* 

試試上面的正則表達式,並與$1

解釋(from here)替換它:

NODE      EXPLANATION 
-------------------------------------------------------------------------------- 
    http      'http' 
-------------------------------------------------------------------------------- 
    s?      's' (optional (matching the most amount 
          possible)) 
-------------------------------------------------------------------------------- 
    :      ':' 
-------------------------------------------------------------------------------- 
    \/      '/' 
-------------------------------------------------------------------------------- 
    \/      '/' 
-------------------------------------------------------------------------------- 
    (      group and capture to \1: 
-------------------------------------------------------------------------------- 
    [^@]+     any character except: '@' (1 or more 
          times (matching the most amount 
          possible)) 
-------------------------------------------------------------------------------- 
)      end of \1 
-------------------------------------------------------------------------------- 
    .*      any character except \n (0 or more times 
          (matching the most amount possible)) 
0

做一個正則表達式查找/替換這樣的:

  • 打開替換對話框
  • 查找內容:https?://([^:]+:[^@]+).*
  • 替換爲:\1
  • 檢查定期表達
  • 單擊替換或全部替換

查找內容爲 RE搜索:

  1. 文字http後跟可選s(由於?
  2. 文字://
  3. 然後我們捕獲:

    1. 一切不是:[^:]+
    2. 字面:
    3. 一切不是@[^@]+

    \1(它放入括號)

  4. ,我們消耗的一切直到行尾(.*