我有一個偉大的URL捕捉正則表達式,但我有一個問題..我不想趕上url的togl.me ...我的正則表達式是:不要得到的網址包含:「togl」[正則表達式]
(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'\".,<>?«»「」‘’]))
這是正則表達式模式:
(?xi)
\b
( # Capture 1: entire matched URL
(?:
https?:// # http or https protocol
| # or
www\d{0,3}[.] # "www.", "www1.", "www2." … "www999."
| # or
[a-z0-9.\-]+[.][a-z]{2,4}/ # looks like domain name followed by a slash
)
(?: # One or more:
[^\s()<>]+ # Run of non-space, non-()<>
| # or
\(([^\s()<>]+|(\([^\s()<>]+\)))*\) # balanced parens, up to 2 levels
)+
(?: # End with:
\(([^\s()<>]+|(\([^\s()<>]+\)))*\) # balanced parens, up to 2 levels
| # or
[^\s`!()\[\]{};:'".,<>?«»「」‘’] # not a space or one of these punct chars
)
)
不要http://togl.me趕上網址。捕捉URL後,我可以用parse_url檢查域名,但爲什麼需要它?
出了什麼問題['parse_url()'](http://php.net/manual/en/function.parse-url.php)? – NullUserException
NullUserException,經過近三年,我看到你的回覆是完全正確的。謝謝, –