Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regular expression for subnet masking?

Tags:

c#

asp.net

I am using regular expression for checking the subnet masking. I use ajax txtbox with masking value but that is not working, then I switched to a textbox and applying a regular expression for that. unfortunatly that one is also not working.

Can you help me out to give a RE for subnet masking 255.255.255.255

Or any best way to do that?

Solution:

I was using masked text box and don't know how to put validation expression.

Finally I found a property of masked text box as validation expression, and there I put the RE and change the property validate to true.

No need to use validator expression explicitly.

Thanks

like image 817
PawanS Avatar asked Mar 19 '11 07:03

PawanS


1 Answers

you can use this regex to validate subnet

^(((255\.){3}(255|254|252|248|240|224|192|128+))|((255\.){2}(255|254|252|248|240|224|192|128|0+)\.0)|((255\.)(255|254|252|248|240|224|192|128|0+)(\.0+){2})|((255|254|252|248|240|224|192|128|0+)(\.0+){3}))$ 
like image 60
Raad Altaie Avatar answered Sep 20 '22 23:09

Raad Altaie