How to Check if String is valid IP4 Adress

Christie Widget Designer Version 6 - Q&A

Moderator: Moderator Group

Forum rules
When asking make sure to include the operating system and the revision of Widget Designer you are using.

How to Check if String is valid IP4 Adress

Postby Daniel Kaminski » Sun Jul 23, 2023 11:02 pm

FYI,

if you want to check if a String is a real IP4 Adress you can use the ".isMatch" Regex Function.

Example

Code: Select all
var str = "192.168.1.100"
DebugMessage(str.IsMatch("^((?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])[.]){3}(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$"))


I hope this is useful for someone.
--
Daniel Kaminski
Pandoras Box Expert
User avatar
Daniel Kaminski
 
Posts: 1050
Joined: Tue Jul 22, 2008 10:55 am
Location: Herten, Germany

Return to Widget Designer V6

Who is online

Users browsing this forum: No registered users and 1 guest