mIRC Homepage
Posted By: PineappleJerky on HOTLINK - Partial word match? - 09/11/18 02:12 AM
mIRC succeccfully recognises URLs when the protocol is connected to another word, e.g. "https://google.com" is hover-able and click-able in "wordhttps://google.com". I cannot figure out how to recreate this behaviour, however.

As an example, I would like to match a single character inside a word. "e" should act as a hotlink in the word "hello", but "h" and "llo" should not. Is this possible?

A regex match captures the character easily, but the on HOTLINK event always matches the entire word, regardless.
Posted By: Wims Re: on HOTLINK - Partial word match? - 09/11/18 03:14 PM
Do you have any code currently?
Posted By: PineappleJerky Re: on HOTLINK - Partial word match? - 09/11/18 03:48 PM
These examples explain no more than my original post, but here are some that do not do what I want:

Code:
on ^*:HOTLINK:*e*:*:{}

on HOTLINK will match all of the following: "e", "he", "ello" and "hello".

Code:
on $^*:HOTLINK:/(e)/:*:{}

$regml(1) will return "e" when it finds the word "hello", but $1 and $hotlink(match) will return "hello". The entire word "hello" will be 'hover-able' (the mouse turns into a pointing hand).
Posted By: Wims Re: on HOTLINK - Partial word match? - 09/11/18 05:20 PM
Ok, so it seems it's not possible to do this currently. on hotlink was meant to match on word, and there's no way currently to know what is the character under the mouse cursor.

However, the built-in hotlink feature is able to do that, I'm fairly certain that it should be possible for the on hotlink event to report such an information, but Khaled has stated that the built-in hotlink feature and the on hotlink event are different: https://forums.mirc.com/ubbthreads.php/ubb/showflat/Number/262119/ & https://forums.mirc.com/ubbthreads.php/ubb/showflat/Number/262120/

I'd still ask for it in the feature suggestions forum.
Posted By: maroon Re: on HOTLINK - Partial word match? - 09/11/18 05:40 PM
I'm seeing what you describe. Also, $hotlinepos also returns the location of the beginning of the entire word. So you can identify which word containing e triggered the match, and $regml(1).pos returns the position within the word of the first match.
Posted By: PineappleJerky Re: on HOTLINK - Partial word match? - 09/11/18 09:07 PM
Thanks, chaps

Edit for anyone following: Suggested here
© mIRC Discussion Forums