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.
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 }
i believe he's trying to extend the wildcarded text *.??.??.??.* to match a string whilst making sure each ? matches one digit
if so:
//echo -a $regex(string,/(\.(?:\d\d\.){3})/) * $regml(1)
$regml(1) returns what was matched, in case it's needed
Ah, ok. I wasn't seeing what he was asking for with how the question was worded.
i believe he's trying to extend the wildcarded text *.??.??.??.* to match a string whilst making sure each ? matches one digit
if so:
//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 }
you should've taken that information from my example
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
if ($regex(%var,/(\.(?:\d\d\.){3})/)) { do this }
EDIT: Beat me to it
THX! How do I make the oposit as !isin dothis ?
How do I make the oposit as !isin dothis ?
if (
!$regex(%var,/(\.(?:\d\d\.){3})/)) { do this }