REGEX for Multicast IP Address

asp.net, ip-address, multicast, regex

Solution

Personally I'd use math, but if you really want a regex,

^2(?:2[4-9]|3\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d?|0)){3}$
 <---|------|-->        <-----> <------> <---> <------> |  |
     |      |           |       |        |     |        |  three more octets
     |      |           |       |        |     |        |
     |      |           |       |        |     |        0
     |      |           |       |        |     |
     |      |           |       |        |     1 - 99
     |      |           |       |        |
     |      |           |       |        100 - 199
     |      |           |       |
     |      |           |       200 - 249
     |      |           |
     |      |           250 - 255
     |      |
     |      230 - 239
     |
     224 - 229

Problem

I have gone through this wonderfull post on stackoverflow Validate IP address is not 0.0.0.0 or multicast address But this is a custom javascript function which i have to write in my aspx page, instead of this is there any regex equivalent which could be helpful to validate the multicast ip-address e.g. multicast IP address between 224.0.0.1 and 239.255.255.255 Thanks in advance for your efforts. :)

Original source

Related problems