mIRC Home    About    Download    Register    News    Help

Print Thread
#61959 27/11/03 12:17 AM
Joined: Jan 2003
Posts: 119
A
AKO Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2003
Posts: 119
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!

#61960 27/11/03 07:48 AM
Joined: Mar 2003
Posts: 1,256
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Mar 2003
Posts: 1,256
Code:
on *:CTCPREPLY:version*: {
  if ($regex($2-,/^mIRC v[5.91]|[6.1]|[6.11]|[6.12] Khaled Mardam-Bey$/)) { 
    do stuff 
  }
}

#61961 27/11/03 12:42 PM
Joined: Jan 2003
Posts: 2,125
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,125
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$/

#61962 05/12/03 10:23 PM
G
GodGell
GodGell
G
it would be a simple

^mIRC v(5.91|6.1|6.11|6.12) Khaled Mardam-Bey$

#61963 05/12/03 10:25 PM
G
GodGell
GodGell
G
or

^mIRC v[3-6].[0-9]([0-9)? Khaled Mardam-Bey$

#61964 05/12/03 10:54 PM
Joined: Feb 2003
Posts: 806
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 806
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..

Last edited by cold; 05/12/03 10:57 PM.

Link Copied to Clipboard