IP Address Regex
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
g_form.hideErrorBox('ip_address');
var pattern =/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/; // regex pattern
if(!pattern.test(newValue)){
g_form.showErrorBox('ip_address', getMessage('Please enter Valid Email Address'));//show error messege
g_form.setValue('ip_address', '');
}
}
Regex Validation only IPv4 address Allowed ServiceNow Client Script (IP Address Regex)
Working Code Edited question July 24, 2023
Sorry, you do not have permission to read comments.