- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-24-2022 07:49 AM
Hello experts please I need your help, how can a regex to accept an IP range be built? for example:
34.3.4.4 - 34.3.4.5
I have this regex from
https://community.servicenow.com/community?id=community_question&sys_id=0cf3a62ddbb8a010fa192183ca96198e
^(?=.*?[1-9])[0-9()-]+$
but it is not working as I need it, I need that the user can add and IP address with the character - so as to add a range, how can that be done?
Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-24-2022 08:10 AM
Hi Jesus,
Try this in variable validation regex
^[0-9]+.[0-9]+.[0-9]+.[0-9]+ \- [0-9]+.[0-9]+.[0-9]+.[0-9]+$
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-24-2022 08:23 AM
Hello Muhammad, yes it is an IP address, and if I add the OOB regex for IP address validation in the variable, it works for one IP address biut not for a range, if I add the character ( - ) the alert says "incorrect IP address"
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-24-2022 08:38 AM
As per my knowledge, Variable Validation Regex is not available for IP Address type variable, So are you using client script for validation ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-24-2022 08:25 AM
Hello Muhhamad, I still get the validation error
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-24-2022 08:31 AM
I just ran a test using this code and it is accepting this with no issue, thank you!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-26-2022 11:38 AM
You should not use that regex. It would accept input of "9999999 - 123456789" which is very clearly not an IP address range.