mIRC Homepage
Posted By: Terrab Regex Troubles - 17/05/06 08:42 PM
I am trying to use non-capturing parenthesis in an on-text regex:
Code:
on $*:text:/^[+-](.+?)(?: (.+))?$/:#: {

but it fails every time. I tried:
Code:
$regex(+Command params,/^[+-](.+?)(?: (.+))?$/)

and it matched just fine.

Could some one tell me why this isn't working?

Thanks.
-Terrab
Posted By: hixxy Re: Regex Troubles - 17/05/06 11:32 PM
The : is a special character in event definitions, so you cannot use the non-capturing ?:
Posted By: starbucks_mafia Re: Regex Troubles - 20/05/06 03:40 PM
You can't use : directly in an event for the reason hixxy gave, however you can use $() around the matchtext to make mIRC evaluate it beforehand so that you can use $chr(58) in place of :.

ie.
Code:
on $*:text:/^[+-](.+?)(?[color:red] $+ $chr(58)[/color] (.+))?$/:#: {
Posted By: hixxy Re: Regex Troubles - 20/05/06 03:53 PM
I never thought of doing that before. Good idea.
© mIRC Discussion Forums