I want to have a validation function it must accept 3 types:
var
portvar
ipvar
one of my problems is in IPvar
user input must be in this syntax as example:
[192.168.1.0/24,10.1.1.0/24]
how can I accept just such Ips from textboxes?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could check it against a regular expression like this:
The regular expression identifies valid IP’s with each part of the IP being a number between 0 and 255. Additionally, as your example shows, each IP must be followed by a single
/and then a number representing the subnet mask. Lastly, multiple IPs are separated by commas (however the regular expression does not allow a comma at the very beginning or the very end).(By the way, the second IP address in your example isn’t valid).