mIRC Homepage
Posted By: file1854 Add highlight exceptions? - 23/02/11 08:22 PM
Hey,

I'm using highlights and I'd like to know if there's a way to add exceptions.

Let's say I'm using "windows" as an highlight but I want to exclude "WindowS" case sensitive, is that possible?

Thanks
Posted By: Riamus2 Re: Add highlight exceptions? - 23/02/11 09:01 PM
There is a case sensitive checkbox in the highlight dialog.
Posted By: file1854 Re: Add highlight exceptions? - 23/02/11 09:44 PM
Originally Posted By: Riamus2
There is a case sensitive checkbox in the highlight dialog.

Yes, but how do I exclude "WindowS" from my highlights, while keeping all other possibilities of capitalization? Like Windows, windowS, WINDOWS, etc...
Posted By: Wims Re: Add highlight exceptions? - 23/02/11 11:06 PM
You can use regex to do that, the pattern /(?!WindowS)(?i)windows/ will match the string "windows" and all its possibilities but "WindowS"
Posted By: file1854 Re: Add highlight exceptions? - 24/02/11 01:58 AM
Originally Posted By: Wims
You can use regex to do that, the pattern /(?!WindowS)(?i)windows/ will match the string "windows" and all its possibilities but "WindowS"

Thanks a lot, it worked. grin
Posted By: Tomao Re: Add highlight exceptions? - 24/02/11 08:18 AM
Wims' regex won't exclude "windowS" though. This one will:/((w|W)indows?)(?!S)/

Never mind. I misread your post.
Posted By: file1854 Re: Add highlight exceptions? - 24/02/11 05:21 PM
One more thing, are the "/" necessary?
Posted By: RoCk Re: Add highlight exceptions? - 24/02/11 05:42 PM

Yes, add it exactly as Wims showed you.
Posted By: Tomao Re: Add highlight exceptions? - 24/02/11 06:13 PM
The forward slash in regex is call delimiter, and it should be used to wrap around a pattern. I have seen people do it without it in MSL without a problem, but it can result an error if you don't include it for php. The may as well apply to other scripting languages.
Posted By: Horstl Re: Add highlight exceptions? - 24/02/11 06:50 PM
Originally Posted By: Tomao
The forward slash in regex is call delimiter, and it should be used to wrap around a pattern. I have seen people do it without it in MSL without a problem, but it can result an error if you don't include it for php.

Omitting the delimiter in MSL is fine - as long as the the expression you aim for does not start with the "m" char. A leading "m" without delimiter defines the following char as the delimiter. But as long as you want to use the default delimiter "/", you don't have to put that "m".
Code:
$regex(bla,test) == $regex(bla,/test/) == $regex(bla,m/test/) == $regex(bla,m@test@)
but
Code:
$regex(bla,mudbug) == $regex(bla,/db/g)


Imo to always include the delimiter is good scripting habit.

Posted By: file1854 Re: Add highlight exceptions? - 24/02/11 06:56 PM
Thanks for the answers, you guys are really helpful.
© mIRC Discussion Forums