IPv6 Regular Expression

Source: Internet
Author: User

/^ S * ([0-9a-fa-f] {1, 4} :) {7} ([0-9a-fa-f] {1, 4} | :)) | ([0-9a-fa-f] {} :) {6 }(: [0-9a-fa-f] {1, 4} | (25 [0-5] | 2 [0-4] d | 1dd | [1-9]? D) (. (25 [0-5] | 2 [0-4] d | 1dd | [1-9]? D) {3}) | :) | ([0-9a-fa-f] {} :) {5} ([0-9a-fa-f] {}) {1, 2 }) | :( (25 [0-5] | 2 [0-4] d | 1dd | [1-9]? D) (. (25 [0-5] | 2 [0-4] d | 1dd | [1-9]? D) {3}) | :) | ([0-9a-fa-f] {} :) {4} ([0-9a-fa-f] {}) {1, 3 }) | (: [0-9a-fa-f] {1, 4 })? :( (25 [0-5] | 2 [0-4] d | 1dd | [1-9]? D) (. (25 [0-5] | 2 [0-4] d | 1dd | [1-9]? D) {3}) | :) | ([0-9a-fa-f] {} :) {3} ([0-9a-fa-f }) | (: [0-9a-fa-f] {}) {} :( (25 [0-5] | 2 [0-4] d | 1dd | [1-9]? D) (. (25 [0-5] | 2 [0-4] d | 1dd | [1-9]? D) {3}) | :) | ([0-9a-fa-f] {} :) {2} (: [0-9a-fa-f }) | (: [0-9a-fa-f] {}) {} :( (25 [0-5] | 2 [0-4] d | 1dd | [1-9]? D) (. (25 [0-5] | 2 [0-4] d | 1dd | [1-9]? D) {3}) | :) | ([0-9a-fa-f] {} :) {1} (: [0-9a-fa-f }) | (: [0-9a-fa-f] {}) {} :( (25 [0-5] | 2 [0-4] d | 1dd | [1-9]? D) (. (25 [0-5] | 2 [0-4] d | 1dd | [1-9]? D) {3}) | :) | (: [0-9a-fa-f] {}) | (: [0-9a-fa-f }) {0, 5} :( (25 [0-5] | 2 [0-4] d | 1dd | [1-9]? D) (. (25 [0-5] | 2 [0-4] d | 1dd | [1-9]? D) {3}) | :)) (%. + )? S * $/

 

Fe80: 0000: 0000: 0000: 0204: 61ff: fe9d: f156 //
Full-format IPv6
Fe80: 0: 0: 0: 204: 61ff: fe9d: f156 // remove IPv6 after the front 0
Fe80: 204: 61ff: fe9d: f156 // use: instead of the IPv6
Fe80: 0000: 0000: 0000: 0204: 61ff: 254.157.241.86 // IPv6 with IPv4
Fe80: 0: 0: 0: 0204: 61ff: 254.157.241.86 // pre-release 0 and IPv6 with IPv4
Fe80: 204: 61ff: 254.157.241.86 // use: instead of IPv6 with IPv4

In addition, the regular expression matches These IPv6 forms:

: 1 // localhost
Fe80: // link-local prefix
2001: // global unicast prefix

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.