mIRC Home    About    Download    Register    News    Help

Print Thread
#216865 04/12/09 11:47 PM
S
s00p
s00p
S
Perhaps I'm confused about how it works...

From the mIRC help:
Quote:
$regex([name], text, re)

Returns N, the number of strings in text that matched the regular expression.


Am I correct if I state for example, that $regex(test,@@@@,/\@/) should return 4 instead of 1? Would someone care to offer some insight as to whether what the mIRC help file states is true, and if so elaborate/clarify? It is either incorrect (and a bug needs to be filed) or I have misunderstood the help documents (and it should be clarified).

#216866 05/12/09 12:11 AM
Joined: Dec 2002
Posts: 3,015
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,015
The regex engine will stop after finding one match if not told to do otherwise with the /g switch.

//echo -a $regex(test,@@@@,/\@/g) will echo 4.

#216867 05/12/09 03:25 AM
Joined: Jul 2007
Posts: 1,124
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,124
Or
Code:
$regex(test,$str(@,4),/[@]/g)

S
s00p
s00p
S
Thank you both.


Link Copied to Clipboard