There is no mating URL but a regular expression other than the picture

Source: Internet
Author: User
Is there a matching URL but a regular expression other than the picture?
For example, can all match,
But Http:// can't match.
The expression I wrote will match to Http:// This paragraph
(http\://)? ([a-z0-9_-]+\.) + (com|net|cn|org) {1} (\/[a-z0-9_-]+) *\.? (?! 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 = ' ' ';
Preg_match_all (' #/[^/]* (? <=\ .... (? ------Solution--------------------
GIF)) "#", $s, $m); -6
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.
(? i) (?: HTTPS?)
FTP)://[-a-z\d.] +/? (?! /) ([-a-z\d+&@#%=~_
!:,.;] +/) * (? #去掉图片的URl) (?! [-a-z\d+&@#%=~_!,.;]. *?\. (?: JPG
BMP)) [-a-z\d+&@#%=~_!,.;] *(?:\? [A-z\d+&@#/%=~_
!:,.;] *)?
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.