mIRC Homepage
Posted By: AKO Real quick Help - 27/11/03 12:17 AM
Hey I need some help with regular expressions, would someone here help me write a regular expression match for the EXACT mIRC version reply. It must meet the following criteria:

- must be case sensitive to the mIRC version reply string. I.E. mIRC v6.12 Khaled Mardam-Bey is not the same as mIRC v6.12 Khaled mardam-Bey
- Must have exact string matching. mIRC v6.12 Khaled Mardam-Bey is not the same as mIRC v6.12 Khaled-Mardam-Bey
- must only allow mIRC versions of 5.91 through 6.12

Thanks for your help if you can help!
Posted By: LocutusofBorg Re: Real quick Help - 27/11/03 07:48 AM
Code:
on *:CTCPREPLY:version*: {
  if ($regex($2-,/^mIRC v[5.91]|[6.1]|[6.11]|[6.12] Khaled Mardam-Bey$/)) { 
    do stuff 
  }
}
Posted By: qwerty Re: Real quick Help - 27/11/03 12:42 PM
Character classes match a single character (hence their name), not a string.
[5.91] matches "5" or "." or "9" or "1"
(?:5\.91) matches "5.91"
You'd have to use something like
Code:
/^mIRC v(?:5\.91|6\.(?:0[1-3]?|1[12]?)) Khaled Mardam-Bey$/
Posted By: GodGell Re: Real quick Help - 05/12/03 10:23 PM
it would be a simple

^mIRC v(5.91|6.1|6.11|6.12) Khaled Mardam-Bey$
Posted By: GodGell Re: Real quick Help - 05/12/03 10:25 PM
or

^mIRC v[3-6].[0-9]([0-9)? Khaled Mardam-Bey$
Posted By: cold Re: Real quick Help - 05/12/03 10:54 PM
1st exp) Not correct, firstly because these are not the only versions the expression should match, secondly because you didn't escape the '.' chars..

2nd exp) This is just the opposite, matches a lot more, even versions that don't exist at all, like 6.69 - you don't need the group there btw

qwerty's expression is pretty simple already, provided that you know a little regex..
© mIRC Discussion Forums