


JavaScript uses regular expressions to detect IP addresses_javascript tips
May 16, 2016 pm 04:29 PMRegular expression:
((2[0-4]d|25[0-5]|[01]?dd?).){3}(2[0-4]d|25[0-5]|[01 ]?dd?)
((2[0-4]d|25[0-5]|[01]?dd?).){3} (2[0-4]d|25[0-5]|[01]?dd?)
The red block represents: the first character is 2, the second character is 0 to 4, and the third character is any digit. Indicates 200~249.
The green block represents: the first character is 2, the second character is 5, and the third character is 0 to 5. Indicates 250~255.
The blue block represents: the first character is 0, or 1, or it does not need this character, the second character is any digit, the third character is any digit, it does not need this character. Represents 1~199, and can have leading zeros.
"|" means "or", as long as it meets the meaning of any one of the three pieces.
The "(" and ")" before and after indicate that this is a group
((2[0-4]d|25[0-5]|[01]?dd?).){3}(2[0-4]d|25[0-5]|[01 ]?dd?)
{3} means repeat three times. For example, "255.255.255."
((2[0-4]d|25[0-5]|[01]?dd?).){3}(2[0-4]d|25[0-5]|[01 ]?dd?)
The meaning of the last group is the same as above, that is, the same test is added after ".".

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP regular expressions: exact matching and exclusion of fuzzy inclusions

PHP regular expression validation: number format detection

How to validate email address in Golang using regular expression?

Simple JavaScript Tutorial: How to Get HTTP Status Code

How to match timestamps using regular expressions in Go?

Is Douyin's IP location real-time positioning? How long does it take for the IP to change when I go out of town?

How to verify password using regular expression in Go?

The national server is stable! Blizzard will authorize the development of World of Warcraft IP, NetEase is the only choice
