【问题标题】:extraction using regex to get domainname url and username使用正则表达式提取以获取域名 url 和用户名
【发布时间】:2018-09-06 03:23:26
【问题描述】:

我正在尝试从以下事件集中提取域、url 和用户名。

例如:域需要是http://damtare.by.ru 网址必须是http://damtare.by.ru/id.txt 名称 - emaxwell(来自电子邮件 ID 的名称)

事件

\d+.\d+\s\d+\s+\S+\s+\S+\s+\d+\s+GET\s(?<domain>http:\/\/[^ \/]+)(?<url>(\S+))\s+(?<user>[^@]+)

https://regex101.com/r/52GMc4/5/

我的正则表达式没有正确提取 URL。非常感谢您的帮助。

【问题讨论】:

标签: regex


【解决方案1】:

你可以试试这个:Regex

基本上,我将您的“url”组移到“域”组之前,并在最后添加了用户。 顺便说一句:您的网址包含空格,不允许!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-01
    • 2011-10-12
    • 2014-11-11
    • 2021-03-04
    • 1970-01-01
    • 2018-10-19
    相关资源
    最近更新 更多