Php 与正则表达式匹配的链接

Php 与正则表达式匹配的链接,php,regex,Php,Regex,我想把link和regex匹配到第一个空格,或者告诉它你不想在.com之后匹配任何点 \b(((http|ftp)(.)?\:\/\/)?(www\.)?example\.com([^\s|<|\.]+)?)\b \b(((http|ftp)(.)?\:\/\/)?(www\.)?example\.com(\/[^\s|<]+)?)\b \b(((http | ftp)()?\:\/\/)?(www\)?example\.com([^\s |这里有一个匹配但不匹配的解决方案 /\

我想把link和regex匹配到第一个空格,或者告诉它你不想在.com之后匹配任何点

\b(((http|ftp)(.)?\:\/\/)?(www\.)?example\.com([^\s|<|\.]+)?)\b
\b(((http|ftp)(.)?\:\/\/)?(www\.)?example\.com(\/[^\s|<]+)?)\b

\b(((http | ftp)()?\:\/\/)?(www\)?example\.com([^\s |这里有一个匹配但不匹配的解决方案


/\b(((http | ftp)()?:\/\/)?(www\)?example\.com(?!\.[\w\d])(\/[^\sSo您特别想匹配
example.com
example.com.au
是一个有效的主机。@KennethK.yes我想匹配
example.com
,但不是
example.com.au
也要匹配所有东西,直到第一个空格出现,像这样
example.com
之后没有点,但要匹配后面的所有东西er
.com
直到出现第一个空格。是的,期待一个前斜杠。我提到的第二个斜杠应该对你很好。上面的正则表达式第一个仍然匹配
example.com
中的
example.com.au
看起来很不错。让我先试试。
\b(((http|ftp)(.)?\:\/\/)?(www\.)?example\.com([^\s|<|\.]+)?)\b
\b(((http|ftp)(.)?\:\/\/)?(www\.)?example\.com(\/[^\s|<]+)?)\b
/\b(((http|ftp)(.)?:\/\/)?(www\.)?example\.com(?!\.[\w\d])(\/[^\s<]*)?)\b/
Match http://example.com/ but not http://example.com.au
This is a sentence about http://example.com/.
http://example.com<
http://example.com/asdf.asdf.asdf/ asdf
http://example.computer