Interpreting Regex for IP range

Document created by Sravan Koneti on Jan 23, 2018Last modified by Sravan Koneti on Apr 12, 2018
Version 3Show Document
  • View in full screen mode

This document outlines the procedure to interpret the regex used for IP range in EPL syntax.

 

{1,3} represents 3 digit number

[0-9] represents range number starting from 0 to 9

 

[0-9]{1,3} represents 3 digit number where each digit starts from 0 to 9.

Example: 000,001,002,....,997,998,999

 

Let me start below regex. I have highlighted the last 2 octets in red color and the first two octets highlighted in black color.

(10\.[0-9]{1,3}|172\.(3[01]|2[0-9]|1[6-9])|192\.168)\.[0-9]{1,3}\.[0-9]{1,3}

The simple [0-9]{1,3}\.[0-9]{1,3} means 000.000 to 999.999

10\.[0-9]{1,3} means 10.000 to 10.999

172\.(3[01]|2[0-9]|1[6-9]) means 172.16 to 172.19 then 172.20-172.29 then 172.30 to 172.31

192\.168 represents same 192.168

 

The complete meaning of this regex covers Private IP range.

10.0.0.0-10.255.255.255

172.16.0.0-172.31.255.255

192.168.0.0-192.168.255.255

 

Hope this document helps.

 

Reference: /^[0-9]{1,3}$/ - Regular Expression - Interpret Please | The ASP.NET Forums 

Regular expression - Wikipedia 

Attachments

    Outcomes