Regular expression for strong match URL address __ Regular expression

Source: Internet
Author: User
Tags regular expression

This regular expression that matches the URL address is a regular expression that we specifically write to filter the external URL address in the post to match all URL addresses. is a strong regular expression that passes through the thoroughly tempered and is detected by fact. Can match all the addresses (if any GG has this regular mismatch address, please contact me, thank you!).

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

Matches: 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 image matches the URL submitted by the validation match Chairou:

As shown, you can see that the regular expression matches the url! with the port.

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

can be fully matched: http://www.topgou.com:80

Previous versions can match pure numbers and fix them:

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

Can exactly match: http://www.123.com:8080/abc/?abc= landlord's match looks not good

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.