For example, http://www.abc.com/and http://www.abc.com/images/index.php can all match,
But Http://www.abc.com/images/logo.gif can't match.
The expression I wrote will match to Http://www.abc.com/images/logo. This paragraph
(http\://)? ([a-z0-9_-]+\.) + (com|net|cn|org) {1} (\/[a-z0-9_-]+) *\.? (?! Jpg|jpeg|gif|png|bmp)
Reply to discussion (solution)
The general URL is followed by other unrelated characters, and it is recommended that you use this character
For example:
"Http://www.abc.com/images/logo.gif"
... Before (?!:jpg|jpeg|gif|png|bmp) (?: ")
Just did not test environment, feel free to write, think of a bit of a problem, find an environment to re-write a
$s = ' http://www.abc.com/image/index.php ' http://www.abc.com/images/logo.gif ';
Preg_match_all (' #/[^/]* (? <=\ .... (? Var_export ($m);
In general, you can understand it and then change it.
Here \ .... Matches the dot and three-character extensions, without a dot extension or a three-character case.
Just did not test environment, feel free to write, think of a bit of a problem, find an environment to re-write a
$s = ' http://www.abc.com/image/index.php ' http://www.abc.com/images/logo.gif ';
Preg_match_all (' #/[^/]* (? <=\ .... (? var_exp ...
Well, it makes sense that HTML pictures are tagged, but there is a situation where the code is BBCode, and fortunately it is tagged, can you help me write this complete expression? Let me give you an example.
[Img=88,31]http://www.discuz.net/images/logo.gif[/img]
Match all the URL addresses except the above two cases, thank you!!!
Halo, can not edit the post, the first line of code is actually BBCode, is the second line without =88,31 this paragraph, the forum to turn it into HTML
In fact, you want to match the hyperlink address, the front plus the href is good match.
(? i) (?: https?| FTP)://[-a-z\d.] +/? (?! /) ([-a-z\d+&@#%=~_|!:,.;] +/) * (? #去掉图片的URl) (?! [-a-z\d+&@#%=~_!,.;]. *?\. (?: jpg|jpeg|gif|png|bmp)) [-a-z\d+&@#%=~_!,.;] *(?:\? [a-z\d+&@#/%=~_|!:,.;] *)?