.net 如何使用正则表达式匹配URL?

.net 如何使用正则表达式匹配URL?,.net,regex,vb.net,.net,Regex,Vb.net,我有字符串: http://example.com/a b.html https://example.net/a+b+c http://example.org/one two three 每个链接都以http或https开头,并包含空格等字符 每一个的结束,都是另一个的开始。 我怎样才能得到它 http://example.com/a b.html https://example.net/a+b+c http://example.org/one two three.html 使用正则表达式?

我有字符串:

http://example.com/a b.html https://example.net/a+b+c http://example.org/one two three
每个链接都以http或https开头,并包含空格等字符
每一个的结束,都是另一个的开始。 我怎样才能得到它

http://example.com/a b.html
https://example.net/a+b+c
http://example.org/one two three.html

使用正则表达式?

此正则表达式应该可以找到您需要的:

https?.+?(?=http|$)
不幸的是,URL不是规则的,这意味着虽然您可以很容易地接近URL,但可能会有一些边缘情况会破坏您的表达式。如果对正则表达式的输入是有限的,这可能没问题。