有关帐户详细信息的Regex帮助

有关帐户详细信息的Regex帮助,regex,notepad++,text-files,Regex,Notepad++,Text Files,我有一个以下格式的文本文件 ======= Account Info ======= email.example@gmail.com:examplepass Subscription:sub Type Expiration date:12/21/18 Country:US Renew Charge:$14.99 + tax DOB:8/18/73 Created By Athena ============================ ======= Account Info ======

我有一个以下格式的文本文件

======= Account Info =======
email.example@gmail.com:examplepass
Subscription:sub Type
Expiration date:12/21/18
Country:US
Renew Charge:$14.99 + tax
DOB:8/18/73
Created By Athena
============================

======= Account Info =======
email.emaple2@yahoo.com:passExample00
Subscription:sub Type
Expiration date:12/5/18
Country:US
Renew Charge:$14.99 + tax
DOB:8/5/74
Created By Athena
============================
如何使用regex以这种格式获取email:pass

email.example@gmail.com:examplepass
email.emaple2@yahoo.com:passExample00

你有试过吗

您可以尝试:

^电子邮件:\w+$

根据您的编辑,更全面的正则表达式是


(^[A-Za-z0-9.\%+-]+@[A-Za-z0-9.-]+\[A-Za-z]{2,}):\w+

根据您的评论,您需要一个相当不受限制的模式。试试这些:

1) 选择“帐户信息”行和“订阅”行之间的所有内容。您需要选中“.matches newline”复选框才能使其工作

(?<=Account Info =======\r\n)(.+?)(?=\r\nSubscription)
缺点:如果您有另一行同时包含
@

    ^.+?@.+?:.+
    
  • Ctrl+F
  • 查找内容:
    \S+@\S+
  • 检查环绕
  • 检查正则表达式
  • 在文档中搜索
说明:

\S+     # 1 or more any character that is not a space
@       # literally @
\S+     # 1 or more any character that is not a space

谢谢你的回答。更新了帖子。我不认为我问的问题正确,但问题已经解决了。你需要让你的要求更精确——这句话总是以“电子邮件”开头吗?或者电子邮件和密码都是完全动态的?还有什么字符是允许的/不允许的?完全动态的。所有字符都是允许的。你可能想编辑你的问题并添加这个(非常重要的)细节。