【发布时间】:2014-03-25 14:43:05
【问题描述】:
这里是 URL 的正则表达式:
(?<protocol>http|ftp)://(?<domain>[^/\r\n]+)(?<path>/[^\r\n]*)?
我想知道如何翻译?就像每个字符/标志的含义一样。
我知道:
(?<protocol>http|ftp)://::'protocol' 是分组名称
http|ftp - http 或 ftp
protocol后面的://必须是这些字符
然后我想澄清一下下面的意思:
`(?<domain>[^/\r\n]+)(?<path>/[^\r\n]*)?`
谢谢
【问题讨论】:
-
转到Regex101并粘贴到
(?<domain>[^\/\r\n]+)(?<path>\/[^\r\n]*)? -
很棒的资源!现在对我来说很清楚了。非常感谢!
-
这个问题似乎是题外话,因为它只是要求一个正则表达式的解释