Strong matching URL address regular expression __ Regular expression

Source: Internet
Author: User
Tags regular expression

This regular expression that matches the URL address is a regular expression that we write specifically to match all the URL addresses in order to filter the external URL address inside the post. Is after the thoroughly tempered, after the fact that the super strong regular expression detection. Can match all the addresses (if the GG has this is not matching the address, please contact me, thank you!).

([/w-]+/.) +[/w-]+. ([^a-z]) (/[/w-/?%&=]*)? | [a-za-z0-9/-/.] [/w-]+. ([^a-z]) (/[/w-./?%&=]*)?

Matching: http://www.tiexue.net, http://www.csdn.net, Http://damon_blog.blog.csdn.net, Http://123.dafa.dfafa

PS: The previous regular expression was filtered out/, now modify, do not use the Insert code to try.

PS2: The following picture matches the URL submitted by Chairou for verification:

As shown in the figure, you can see that this regular expression does match the url! with the port

Second Edition: ([/w-]+/.) +[/w-]+. ([^a-z]) (/[/w-:./?%&=]*)? | [a-za-z0-9/-/.] [/w-]+. ([^a-z]) (/[/w-:./?%&=]*)?

Can complete match: http://www.topgou.com:80

The previous version can match the pure numbers and fix them again:

([/w-]+/.) +[/w-]+. ([^a-z]) (/[/w-:./?%&=]*)? | [a-za-z/-/.] [/w-]+. ([^a-z]) (/[/w-:./?%&=]*)?

Can match exactly: Http://www.123.com:8080/abc/?abc= Landlord's match seemingly not

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: info-contact@alibabacloud.com 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.