mIRC Homepage
Posted By: klaaamp number iswm - 11/12/06 09:27 PM
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.
Posted By: Riamus2 Re: number iswm - 11/12/06 10:08 PM
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 }
Posted By: jaytea Re: number iswm - 11/12/06 10:15 PM
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
Posted By: Riamus2 Re: number iswm - 11/12/06 10:23 PM
Ah, ok. I wasn't seeing what he was asking for with how the question was worded.
Posted By: klaaamp Re: number iswm - 11/12/06 11:14 PM
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 }
Posted By: jaytea Re: number iswm - 11/12/06 11:47 PM
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
Posted By: Riamus2 Re: number iswm - 11/12/06 11:49 PM
Code:
if ($regex(%var,/(\.(?:\d\d\.){3})/)) { do this }


EDIT: Beat me to it wink
Posted By: klaaamp Re: number iswm - 12/12/06 12:59 AM
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 ?
Posted By: RoCk Re: number iswm - 12/12/06 02:53 AM
Quote:
How do I make the oposit as !isin dothis ?


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