thomasschmidt93 Posted September 25, 2013 Share Posted September 25, 2013 Hello community, I have failed to create a regular expression that checks a custom field for a valid IP address. I have looked up multiple expressions on the internet, but it always return non-valid. Does anyone of you have an expression that I can copy paste in to my custom field validation? Respectfully, Thomas Schmidt 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 25, 2013 Share Posted September 25, 2013 try this... /^((25[0-5]|2[0-4][0-9]|[01]?[1-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[1-9][0-9]?)$/ 0 Quote Link to comment Share on other sites More sharing options...
thomasschmidt93 Posted September 30, 2013 Author Share Posted September 30, 2013 Hello, I'm so sorry for the late response! That is working beautifully, but it also blocks if nothing i typed in the field, and this field is not required, but if a client specifies something in there, it needs to check it. How can I change, so it also allows nothing? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 30, 2013 Share Posted September 30, 2013 Hi Thomas, try the following - it should check for the field being empty and allow it - though if something is entered, it will still check that it's a valid IP address. /^(?((25[0-5]|2[0-4][0-9]|[01]?[1-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[1-9][0-9]?))$/ 0 Quote Link to comment Share on other sites More sharing options...
thomasschmidt93 Posted September 30, 2013 Author Share Posted September 30, 2013 Hi Thomas, try the following - it should check for the field being empty and allow it - though if something is entered, it will still check that it's a valid IP address. It works! Thank you very much! 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.