mIRC Home    About    Download    Register    News    Help

Print Thread
Single Character Highlights #245823 09/05/14 06:07 PM
Joined: May 2014
Posts: 6
M
mmmmm Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
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

Re: Single Character Highlights [Re: mmmmm] #245843 10/05/14 07:26 PM
Joined: Jul 2006
Posts: 3,559
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,559
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 $+ (?:$|[ :])/


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Single Character Highlights [Re: Wims] #245875 11/05/14 04:34 PM
Joined: May 2014
Posts: 6
M
mmmmm Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: May 2014
Posts: 6
Originally Posted By: Wims
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

Re: Single Character Highlights [Re: mmmmm] #245876 11/05/14 04:35 PM
Joined: Jul 2006
Posts: 3,559
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,559
What was the value of $me when you tried?


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Single Character Highlights [Re: Wims] #245877 11/05/14 04:42 PM
Joined: May 2014
Posts: 6
M
mmmmm Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: May 2014
Posts: 6
Originally Posted By: Wims
What was the value of $me when you tried?


M

Re: Single Character Highlights [Re: mmmmm] #245878 11/05/14 05:23 PM
Joined: Jul 2006
Posts: 3,559
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,559
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.

Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Single Character Highlights [Re: Wims] #245889 12/05/14 06:34 PM
Joined: May 2014
Posts: 6
M
mmmmm Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: May 2014
Posts: 6
Originally Posted By: Wims
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

Re: Single Character Highlights [Re: mmmmm] #245891 12/05/14 07:41 PM
Joined: Jul 2006
Posts: 3,559
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,559
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.


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Single Character Highlights [Re: Wims] #245919 14/05/14 03:23 AM
Joined: May 2014
Posts: 6
M
mmmmm Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: May 2014
Posts: 6
Originally Posted By: Wims
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

Re: Single Character Highlights [Re: mmmmm] #245931 14/05/14 11:38 AM
Joined: Jul 2006
Posts: 3,559
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,559
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])/)


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Single Character Highlights [Re: Wims] #245948 15/05/14 03:12 PM
Joined: May 2014
Posts: 6
M
mmmmm Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
M
Joined: May 2014
Posts: 6
Originally Posted By: Wims
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 smile