MattX 0 Posted February 4, 2012 Is it possible to code a conditional statement using an IP scope ? Example: IF IP Address = 10.165.5.XX then Do something Can @IPaddress1 be used or will it have to be done differently ? And if differently I'm after a suggestion !! Thanks. Share this post Link to post Share on other sites
jaberwacky 327 Posted February 4, 2012 You mean where XX could be any number but the rest must remain the same? Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Share this post Link to post Share on other sites
MattX 0 Posted February 4, 2012 You mean where XX could be any number but the rest must remain the same?Yes. Share this post Link to post Share on other sites
jaberwacky 327 Posted February 4, 2012 Regular Expressions.This works for me:#include <Array.au3> Global $result = StringRegExp("10.165.5.6.79", "10.165.5.d+.d+", 1) _ArrayDisplay($result) Exit 1 MattX reacted to this Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Share this post Link to post Share on other sites
MattX 0 Posted February 4, 2012 Thanks - I'll give that a go later - will let you know when I get stuck..... Share this post Link to post Share on other sites
autoitter 3 Posted February 4, 2012 $strIP = "10.165.5.30" If StringRegExp($strIP, "10\.165\.5\.[0-9]{1,3}") Then ConsoleWrite("Match!" & @CRLF) EndIf Share this post Link to post Share on other sites
ProgAndy 88 Posted February 4, 2012 Keep in mind, that the dot has a special meaning in regular expressions (any character), so you should use .StringRegExp("12.13.14.45", "^12.13.14.d{1,3}$", 1)Meaning:^ - Match beginning of string12 - Match characters 1 and 2. - Match a dot13 - Match 13. - dot14 - 14. - dotd{1,3} - match specific amount of digits: at least one, at most three$ - Match end of string *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Share this post Link to post Share on other sites