删除电子邮件名称?

时间:2016-04-17 12:28:02

标签: notepad++

https://adharia78@gmail.com:lat66pie@www.walmart.com/account/login
https://teresecharlene3@gmail.com:Reecewalker2431@controlboard.getcontrol.co/login

我需要

adharia78@gmail.com:lat66pie
teresecharlene3@gmail.com:Reecewalker2431

我尝试([@]*)@.*替换$1但不能正常工作

2 个答案:

答案 0 :(得分: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))

答案 1 :(得分:0)

正则表达式查找/替换如下:

  • 打开替换对话框
  • 查找内容: https?://([^:]+:[^@]+).*
  • 替换为: \1
  • 检查正则表达式
  • 点击替换或全部替换

查找内容 RE搜索:

  1. 文字http后跟可选s(由于?
  2. 文字://
  3. 然后我们捕获:

    1. 一切都不是:[^:]+
    2. 文字:
    3. 一切都不是@[^@]+
    4. 进入\1(将其括在括号中)

    5. 我们将所有内容消耗到行尾(.*