Regular Expressions-IP address, MAC address, port, latitude and longitude, license plate number check

Source: Internet
Author: User

IP Address Verification:/^ (\d|[ 1-9]\D|1\D{2}|2[0-5][0-5]) \. (\d| [1-9]\d|1\d{2}|2[0-5][0-5]) \. (\d| [1-9]\d|1\d{2}|2[0-5][0-5]) \. (\d| [1-9]\d|1\d{2}|2[0-5][0-5]) $/The format is made up of "." Divided by four parts, each part of the range is0-255;Each section of the regular can be divided into several parts to write:200-255;100-199;10-99;0-9;The corresponding regular expression for each part:2[0-5][0-5];      1\D{2};  [1-9]\d; \dConnect up to:\d| [1-9]\d|1\d{2}|2[0-5][0-5]The regular IP is(\d|[ 1-9]\D|1\D{2}|2[0-5][0-5]) \. (\d| [1-9]\d|1\d{2}|2[0-5][0-5]) \. (\d| [1-9]\d|1\d{2}|2[0-5][0-5]) \. (\d| [1-9]\d|1\d{2}|2[0-5][0-5]) MAC Address Verification:/^[a-f0-9]{2} (-[a-f0-9]{2}) {5}$|^[a-f0-9]{2} (: [a-f0-9]{2}) {5}$/There are two types of MAC addresses:58:e8:76:83:a2:c7/^[a-fa-f0-9]{1,2}\:[a-fa-f0-9]{1,2}\:[a-fa-f0-9]{1,2}\:[a-fa-f0-9]{1,2}\:[a-fa-f0-9]{1,2}\:[a-fa-f0-9]{ 1,2}$/ 58-e8-76-83-a2-c7 /^[a-fa-f0-9]{1,2}\-[a-fa-f0-9]{1,2}\-[a-fa-f0-9]{1,2}\-[a-fa-f0-9]{1,2}\-[a-fa-f0-9]{1,2}\-[a-fa-f0-9 ]{1,2}$/ After shorthand:/^[a-f0-9]{2} (-[a-f0-9]{2}) {5}$/ /^[a-f0-9]{2} (: [a-f0-9]{2}) {5}$/ Port authentication :/^ ([0-9]|[ 1-9]\d{1,3}| [1-5]\d{4}|6[0-5]{2}[0-3][0-5]) $/Format is0-65535Divided into several parts to construct:60000-65535;10000-59999;1000-9999;100-999;10-99;0-9;The regular of each part is:6[0-5]{2}[0-3][0-5];      [1-5]\d{4};     [1-9]\d{3}; [1-9]\d{2}; [1-9]\d; [0-9]After finishing is:([0-9]|[ 1-9]\d{1,3}| [1-5]\d{4}|6[0-5]{2}[0-3][0-5]) Longitude Check:/^[\-\+]? (0?\d{1,2}|0?\d{1,2}\.\d{1,15}|1[0-7]?\d{1}|1[0-7]?\d{1}\.\d{1,15}|180|180\.0{1,15}) $/ Latitude Check:/^[\-\+]? ([0-8]?\d{1}| [0-8]?\d{1}\.\d{1,15}|90|90\.0{1,15}] $/ License plate number check:/^[jing Jin hu yu ji yu Yun Liao Hei Xiang Wan lu xin su zhe gan e Guiganjin Meng Shan Gi Jingui Guangdong Qinghai-Tibet Kanningjong led]{1}[a-hj-za-hj-z]{1}[police Beijing-Tianjin-Chongqing-Hebei-Henan Yun Liao Hei Xiang Wan lu xin su zhe gan e Guiganjin Mongolia Shaanxi Gi Jingui Guangdong Qinghai-Tibet Kanningjong]{0,1}[ A-hj-np-za-hj-np-z0-9]{4,5}[a-hj-np-za-hj-np-z0-9 Hang School Police Hong Kong and Macao]{1}$/

Regular expression-IP address, MAC address, port, latitude and longitude, license plate number check

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.