mIRC Home    About    Download    Register    News    Help

Print Thread
#166516 11/12/06 09:27 PM
Joined: Dec 2006
Posts: 31
K
klaaamp Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Dec 2006
Posts: 31
How do I make a match in a word for this *.xx.xx.xx.* like iswm
The xx must be numbers and they need to be exact 2 numbers.

klaaamp #166518 11/12/06 10:08 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
If you are looking for a specific part of that and not the entire set of numbers, you can use $istok.

if ($istok(111.15.57.24,57,46)) { echo -a Match }

The red number is the item you're looking for, and the blue number is the ascii value for a period (the separator used in that number).

If you're looking for the entire thing in a sentence, you can use:

if (111.15.57.24 isin $1-) { echo -a Match }

That assumes you put that into an event that has $1- (such as an on TEXT event).

If you want to check for more a match that ignores part of the number, you can use:

if (*111.*.57.24* iswm $1-) { echo -a Match }


Invision Support
#Invision on irc.irchighway.net
Riamus2 #166521 11/12/06 10:15 PM
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
i believe he's trying to extend the wildcarded text *.??.??.??.* to match a string whilst making sure each ? matches one digit smile

if so:

Code:
//echo -a $regex(string,/(\.(?:\d\d\.){3})/) * $regml(1)


$regml(1) returns what was matched, in case it's needed


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
jaytea #166522 11/12/06 10:23 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Ah, ok. I wasn't seeing what he was asking for with how the question was worded.


Invision Support
#Invision on irc.irchighway.net
jaytea #166527 11/12/06 11:14 PM
Joined: Dec 2006
Posts: 31
K
klaaamp Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Dec 2006
Posts: 31
Originally Posted By: jaytea
i believe he's trying to extend the wildcarded text *.??.??.??.* to match a string whilst making sure each ? matches one digit smile

if so:

Code:
//echo -a $regex(string,/(\.(?:\d\d\.){3})/) * $regml(1)


$regml(1) returns what was matched, in case it's needed


I want it work like this: if (*.xx.xx.xx.* iswm %var) { dothis }

klaaamp #166531 11/12/06 11:47 PM
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
you should've taken that information from my example

Code:
if ($regex(%var,/\.(?:\d\d\.){3}/)) {
  ; stuff
}


i guess i should've mentioned that the $regex() will return 1 if the match was successful and 0 otherwise grin


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
klaaamp #166532 11/12/06 11:49 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Code:
if ($regex(%var,/(\.(?:\d\d\.){3})/)) { do this }


EDIT: Beat me to it wink

Last edited by Riamus2; 11/12/06 11:50 PM.

Invision Support
#Invision on irc.irchighway.net
Riamus2 #166536 12/12/06 12:59 AM
Joined: Dec 2006
Posts: 31
K
klaaamp Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Dec 2006
Posts: 31
Originally Posted By: Riamus2
Code:
if ($regex(%var,/(\.(?:\d\d\.){3})/)) { do this }


EDIT: Beat me to it wink


THX! How do I make the oposit as !isin dothis ?

klaaamp #166537 12/12/06 02:53 AM
Joined: Dec 2002
Posts: 2,031
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,031
Quote:
How do I make the oposit as !isin dothis ?


if (!$regex(%var,/(\.(?:\d\d\.){3})/)) { do this }


Link Copied to Clipboard