|
Joined: May 2014
Posts: 6
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: May 2014
Posts: 6 |
Not sure if this should be in here or in the scripts section.
Just wondering if there is there any way to limit highlights for a single character nickname with regex so the highlight only triggers on exact match and exact match followed by a symbol?
Currently using $me with match on message (matching nick/both triggers the highlight when someone with symbols in their nick speaks)
for example:
Z (wanted) Z: (wanted)
:Z (unwanted)
Preferably using the built in highlighting rather than a standalone script, I don't mind it as it is but it would be nice to remove the 'false' highlights if possible.
Cheers
|
|
|
|
Joined: Jul 2006
Posts: 4,150
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,150 |
mIRC currently lacks the possibility to use $identifier with parameters inside the highlight's entry. You can use $me but $me might very well contain meaningful characters used in regex, which would need to be escaped, this is usually done with a simple $replacecs(), but like I just said you cannot use $replacecs() here so there are no way to use $me correctly with a regex match. That said, it's quite ok to assume that $me won't contain anything meaningful in regex and according to your three examples, you could try to use /(?:^| ) $+ $me $+ (?:$|[ :])/
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: May 2014
Posts: 6
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: May 2014
Posts: 6 |
mIRC currently lacks the possibility to use $identifier with parameters inside the highlight's entry. You can use $me but $me might very well contain meaningful characters used in regex, which would need to be escaped, this is usually done with a simple $replacecs(), but like I just said you cannot use $replacecs() here so there are no way to use $me correctly with a regex match. That said, it's quite ok to assume that $me won't contain anything meaningful in regex and according to your three examples, you could try to use /(?:^| ) $+ $me $+ (?:$|[ :])/ Unfortunately I couldn't get anything to trigger a highlight when using this
|
|
|
|
Joined: Jul 2006
Posts: 4,150
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,150 |
What was the value of $me when you tried?
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: May 2014
Posts: 6
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: May 2014
Posts: 6 |
What was the value of $me when you tried? M
|
|
|
|
Joined: Jul 2006
Posts: 4,150
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,150 |
And what was the line sent to test this?
Bah, mIRC needs a way to know it must evaluate the entry, use $(/(?:^| ) $+ $me $+ (?:$|[ :])/)
Last edited by Wims; 11/05/14 05:32 PM.
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: May 2014
Posts: 6
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: May 2014
Posts: 6 |
And what was the line sent to test this?
Bah, mIRC needs a way to know it must evaluate the entry, use $(/(?:^| ) $+ $me $+ (?:$|[ :])/) As far as I can tell that's working great, is it possible to allow symbols such as ?!,. to trigger the highlight instead of just : Thanks
|
|
|
|
Joined: Jul 2006
Posts: 4,150
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,150 |
Yes, you can add anything between \Q and \E: $(/(?:^| ) $+ $me $+ (?:$|[\Q :?!\E])/) Though, like I said, you might quickly end up wanting the behavior of \b, which handles exactly that kind of situation.
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: May 2014
Posts: 6
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: May 2014
Posts: 6 |
Yes, you can add anything between \Q and \E: $(/(?:^| ) $+ $me $+ (?:$|[\Q :?!\E])/) Though, like I said, you might quickly end up wanting the behavior of \b, which handles exactly that kind of situation. This also works great, until a comma is used, which results in no highlights working
|
|
|
|
Joined: Jul 2006
Posts: 4,150
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,150 |
Right, you might be familiar with the identifier syntax, where the comma is the character used to seperate arguments:
$identifier(<arg1>,<arg2>,<argN>)
You cannot use a litteral comma as part of an argument, you must escape it for mIRC to see it as part of the argument. One way to achieve that is to use $chr(44):
$(/(?:^| ) $+ $me $+ (?:$|[\Q $chr(44) $+ :?!\E])/)
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
Joined: May 2014
Posts: 6
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: May 2014
Posts: 6 |
Right, you might be familiar with the identifier syntax, where the comma is the character used to seperate arguments:
$identifier(<arg1>,<arg2>,<argN>)
You cannot use a litteral comma as part of an argument, you must escape it for mIRC to see it as part of the argument. One way to achieve that is to use $chr(44):
$(/(?:^| ) $+ $me $+ (?:$|[\Q $chr(44) $+ :?!\E])/) That's excellent, thanks a lot for the constant help
|
|
|
|
|