Jump to content
Sign in to follow this  
MattX

Quick IP Scope Question

Recommended Posts

MattX

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
MattX

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

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
  • Like 1

Share this post


Link to post
Share on other sites
MattX

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
ProgAndy

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 string

12 - Match characters 1 and 2

. - Match a dot

13 - Match 13

. - dot

14 - 14

. - dot

d{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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.