c# - Regular Expression to Match IP Subnet -


i need c# regular expression match ip subnet, "127.65.231", not match ip address on subnet, "127.65.231.111". had found regex ip address:

@"\b\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}\b"

and thinking delete part checks last octet, this:

@"\b\d{1,3}.\d{1,3}.\d{1,3}\b"

but matches both ip address , subnet. can this?

@"^\d{1,3}\.\d{1,3}\.\d{1,3}$" 

use line anchors. add ^ @ beginning of regex, , $ @ end, verify beginning , end of input.

this match 127.65.231 not 127.65.231.111


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -