mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Apr 2007
Posts: 3
U
Self-satisified door
OP Offline
Self-satisified door
U
Joined: Apr 2007
Posts: 3
One thing I have been frustrated about for a long time is the lack of the repeating operator (syntax being: {min,max} in the regex engine. It would be wonderful if you could add that to the regex engine in mIRC. For more info see http://www.regular-expressions.info/repeat.html

Khaled, your program is great. Keep up the good work!

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
It works fine, you just have to enclose it inside capturing brackets or put the regex in a variable first. This is because mIRC sees the , as an argument separator for the identifier.

Method 1: //echo -a $regex(abc,/(?:.{1,3})/)

Method 2: //var %re = /.{1,3}/ | echo -a $regex(abc,%re)

Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
mirc's regex libraries already support the {N,M} quantifier!

Code:
//var %regex = /lo{1,5}l/ | echo -a $regex(looool,%regex)


i suspect you're having trouble with that comma, trying to plug it into the regex directly:

Code:
//echo -a $regex(looool,/lo{1,5}l/)


reason that doesn't work is pretty much the same effect as putting a comma directly into any other identifier. in the above, $regex() is passed 3 parameters, name = looool, string = /lo{1 and regex = 5}l/

there's a workaround, you can put the comma inside a group of parentheses:

Code:
//echo -a $regex(looool,/(?:lo{1,5}l)/)


if enclosed in (), the comma is no longer seen as a parameter separator :>


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Joined: Apr 2007
Posts: 3
U
Self-satisified door
OP Offline
Self-satisified door
U
Joined: Apr 2007
Posts: 3
Hm, maybe. But it would be usefull if we didn't have to do all that work grin

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
It's really not possible not to, since mIRC wouldn't be able to tell whether you're passing a name, a string and expression, or just a string and expression.


Link Copied to Clipboard