- 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 07:56 AM
Hi,
Try this please.
^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$
Example
Accept:
127.0.0.1
192.168.1.1
192.168.1.255
255.255.255.255
0.0.0.0
1.1.1.01
Reject:
30.168.1.255.1
127.1
192.168.1.256
-1.2.3.4
1.1.1.1.
3...3
Mark Correct or Helpful if it helps.
***Mark Correct or Helpful if it helps.***
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-24-2022 08:03 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-24-2022 08:37 AM
Oo Yes that was for IP address not Ip range.
Glad you found the answer.
***Mark Correct or Helpful if it helps.***
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-24-2022 08:38 AM
Thank you Yousaf for your help!!