- 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-26-2022 04:33 PM
As for IP Address validation, there is already an OOTB Variable Validation Regex Available for IP Addresses, So he might/could have used that one or the one provided by
By the way I have created a regex for IP Addresses ( separated by " - " ) Validation, can you please validate that one as well, whether it is working or not ?
^(([0]|[1-9][0-9]{0,1}|[1][0-9][0-9]|[2][0-5][0-5])\.){3}([0]|[1-9][0-9]{0,1}|[1][0-9][0-9]|[2][0-5][0-5]) \- (([0]|[1-9][0-9]{0,1}|[1][0-9][0-9]|[2][0-5][0-5])\.){3}([0]|[1-9][0-9]{0,1}|[1][0-9][0-9]|[2][0-5][0-5])$
- 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.