开发者

Regex to catch url in a string [duplicate]

开发者 https://www.devze.com 2023-02-22 09:38 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicates: Regex to match URL What is the best regular expression to check if开发者_Go百科 a string is a valid URL
This question already has answers here: Closed 11 years ago.

Possible Duplicates:

Regex to match URL

What is the best regular expression to check if开发者_Go百科 a string is a valid URL

I want to catch urls in strings if any. What is the best regex for this? Urls may or not be abolute.

http://www.blabla.com

http://blabla.com

www.blabla.com

all should match.

Thank you.

\b(https?)://[-A-Z0-9+&@#/%?=~|!:,.;]*[-A-Z0-9+&@#/%=~|]. this regex is enough to some degree but no match for www.blabla.com , so how can i edit to catch the latter either?

0

精彩评论

暂无评论...
验证码 换一张
取 消