Ip address validation

lucky24
Tera Contributor

Hi Team,

 

I have to add IP validation and It should be 0.0.0.0/XX to 255.255.255.255/XX range, Where XX can be 00 to 32 range numbers and / is optional.

 

I tried with validation regex in variable it self like below but it is not working.

 

lucky24_0-1702875850937.png

Can someone please help me on this?

2 ACCEPTED SOLUTIONS

Harish Bainsla
Kilo Patron
Kilo Patron

Hi try below regex

^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\/([0-9]|[12][0-9]|3[0-2]))?$

View solution in original post

Tai Vu
Kilo Patron
Kilo Patron

Hi @lucky24 

The selected validation regex from your screenshot is the OOTB one. You can find that record in the Question Regular Expression [question_regex] table.

Name: IP Address

URL: https://<instance_name>/question_regex.do?sys_id=f2f52405530020107d13ddeeff7b12d6

 

You can define your own regular expression for the variable.

Sample below.

^(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}\/(?:3[0-2]|[0-2]?[0-9])$

Screenshot 2023-12-18 at 12.51.19.png

Cheers,

Tai Vu

View solution in original post

2 REPLIES 2

Harish Bainsla
Kilo Patron
Kilo Patron

Hi try below regex

^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\/([0-9]|[12][0-9]|3[0-2]))?$

Tai Vu
Kilo Patron
Kilo Patron

Hi @lucky24 

The selected validation regex from your screenshot is the OOTB one. You can find that record in the Question Regular Expression [question_regex] table.

Name: IP Address

URL: https://<instance_name>/question_regex.do?sys_id=f2f52405530020107d13ddeeff7b12d6

 

You can define your own regular expression for the variable.

Sample below.

^(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}\/(?:3[0-2]|[0-2]?[0-9])$

Screenshot 2023-12-18 at 12.51.19.png

Cheers,

Tai Vu