In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-11-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "the matching method of IP address regular expression". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the matching method of IP address regular expression.
Regular expressions (Regular Expression, often abbreviated as regex, regexp, or RE in code) is a concept in computer science. Regular expressions use a single string to describe and match a series of strings that conform to a syntactic rule. In many text editors, regular expressions are often used to retrieve and replace text that matches a certain pattern. Many programming languages support string manipulation using regular expressions. In many text editors, regular expressions are often used to retrieve and replace text that matches a certain pattern.
Regular expression
^ (25 [0-5] | 2 [0-4] [0-9] | [0-1] {1} [0-9] {2} | [1-9] {1} [0-9])\. (25 [0-5] | 2 [0-4] [0-9] | [0-1] {1} [0-9] {1} | [1-9] {1} | [1-9]) | | 0)\. (25 [0-5] | 2 [0-4] [0-9] | [0-1] {1} [0-9] {2} | [1-9] {1} [0-9] {1} | [1-9] | 2 [0-4] [0-9] | [0-1] {1} [0-9] {1} | [0-9]) $
Match 127.0.0.1 | 255.255.255.0 | 192.168.0.1
Mismatch 1200.5.4.3 | abc.def.ghi.jkl | 255.foo.bar.1
Regular expression
^ ((0 | 1 [0-9] {0rect 2} | 2 [0-9] {0rect 1} | 2 [0-4] [0-9] | 25 [0-5] | [3-9] [0-9] {0jue 1})\.) {3} (0 | 1 [0-9] {0jue 2} | 2 [0-9] {0jue 1} | 2 [0-4] [0-9] | 25 [0-5] | [3-9] [0-9] {0jue 1}) (? (\ /) 0-9] | [1-2] [0-9] | 3 [0-2]) |) $
Match 192.168.0.1 | 192.168.0.1 Universe 32 | 255.255.0.0 Uniplet1
Mismatch 010.0.0.0 | 192.168.0.1 Universe 33 | 256.0.1.55
Regular expression
^ (25 [0-5] | 2 [0-4] [0-9] | 1 [0-9] [0-9] | [0-9] {1 minute 2}) (\. (25 [0-5] | 2 [0-4] [0-9] | 1 [0-9] [0-9] | [0-9] {1} 2})) {3}
Match 97.67.44.20 | 199.154.37.214 | 127.0.0.1
Mismatch 63.125.94.287 | 140.370.a.187 | 94.923.1
Regular expression
/ ^ ([01]?\ d?\ d | 2 [0-4]\ d | 25 [0-5]) {3} ([01]?\ d?\ d | 2 [0-4]\ d | 25 [0-5])\ / (\ d {1} | [0-2] {1}\ d {1} | 3 [0-2]) $/
Matches 192.168.100.1swap 24 | 0.0.0.0 Universe 0
Does not match 192.168.100.1swap 33 | 0.0.0.0 cue 90
Regular expression
\ d +.\ d +.
Match 127.0.0.1 | 255.255.255.0 | 192.168.0.1
Does not match @ # .5.4.3 | abc.def.ghi.jkl | 255.foo.bar.1
Regular expression
^ ((\ d |\ d]\ d | [0-4]\ d | 2 [0-4]\ d | 25 [0-5])\. (\ d |\ d |\ d\ d | 2 [0-4]\ d | 25 [0-5])\. (\ d |\ d |\ d\ d | [0-1]\ d | 2 [0-4]\ d | 25 [0-5])\. (\ d |\ d\ d | [0-1]\ d\ d | 2 [0-4]\ d | 25 [0-5]) $
Match 1.198.0.1 | 100.10.0.1 | 200.200.123.123
Mismatch. 12.23 | a.23.345 | 400.500.300.300
Regular expression
^ (\ d {1pr 2} | 1\ d\ d | 2 [0-4]\ d | 25 [0-5])\. (\ d {1 pm 2} | 1\ d\ d | 2 [0-4]\ d | 25 [0-5])\. (\ d {0-4]\ d | 2 [0-4])\ d | 25 [0-5])\. (\ d {1J 2} | 1\ d\ d | 2 [0-4]\ d | 25 [0-5]) $
Match 0.0.0.0 | 255.255.255.02 | 192.168.0.136
Mismatch 256.1.3.4 | 023.44.33.22 | 10.57.98.23.
Regular expression
^ (http | https | ftp)\: / / ((25 [0-5] | 2 [0-4] [0-9] | 1 [0-9] [0-9] | [1-9] [0-9] | [0-9] | 2 [0-4] [0-9] | 1 [0-9] [0-9] | [1-9] [0-9]) | ([a-zA-Z0-9]) (com | net | org | edu | mil | gov | arpa | biz | name | coop | info | pro | museum | uk | me)) ((: [a-zA-Z0-9] *)? /? ([a-zA-Z0-9\ -\. _\?\) \'/\\ + &%\ $#\ = ~]) *) $
Match http://www.allkins.com | http://255.255.255.255 | http://allkins.com/page.asp?action=1
Do not match http://test.testing
Regular expression
^ ([0 # 2] * [0 # 9] +)\. ([0 # 2] * [0 # 9] +)\. ([0 # 2] * [0 # 9] +)\. ([0 # 2] * [0 # 9] +)) $
Match 113.173.40.255 | 171.132.248.57 | 79.93.28.178
Mismatch 189.57.135 | 14.190.193999 | A.N.D.233
Regular expression
\ b (([01]?\ d?\ d | 2 [0 # 4]\ d | 25 [0 # 5])\.) {3} ([01]?\ d?\ d | 2 [0 # 4]\ d | 25 [0 # 5])\ b
Match 217.6.9.89 | 0.0.0.0 | 255.255.255.255
Mismatch 256.0.0.0 | 0978.3.3.3 | 65.4t.54.3
At this point, I believe you have a deeper understanding of "the matching method of IP address regular expressions". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.