MattX Posted February 4, 2012 Share 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. Link to comment Share on other sites More sharing options...
jaberwacky Posted February 4, 2012 Share 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? Link to comment Share on other sites More sharing options...
MattX Posted February 4, 2012 Author Share Posted February 4, 2012 You mean where XX could be any number but the rest must remain the same?Yes. Link to comment Share on other sites More sharing options...
jaberwacky Posted February 4, 2012 Share 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 MattX 1 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? Link to comment Share on other sites More sharing options...
MattX Posted February 4, 2012 Author Share Posted February 4, 2012 Thanks - I'll give that a go later - will let you know when I get stuck..... Link to comment Share on other sites More sharing options...
autoitter Posted February 4, 2012 Share Posted February 4, 2012 $strIP = "10.165.5.30" If StringRegExp($strIP, "10\.165\.5\.[0-9]{1,3}") Then ConsoleWrite("Match!" & @CRLF) EndIf Link to comment Share on other sites More sharing options...
ProgAndy Posted February 4, 2012 Share 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now