mIRC Home    About    Download    Register    News    Help

Print Thread
#60886 18/11/03 08:50 AM
Joined: Nov 2003
Posts: 2
K
Kester Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
K
Joined: Nov 2003
Posts: 2
I would like to parse a line of text, using regular expressions (i have good knowlegde of reg expr, don't worry), but I can't seem to find a way to parse a string that contains comma's.
Code:
 $regexp(%var,re) 

works fine, as long as the %var doesn't contian any comma's. I tried to put all sorts of brackets around %var, but I couldn't find a solution...
Can anyone help me?

#60887 18/11/03 08:59 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
I'm not sure what you mean. Commas in variables work fine:
Code:
//var %a = this,is,a,test | echo -a $regex(%a,/is/)
Maybe the problem is that you used commas directly in the <re> parameter. For example, this:
Code:
//var %a = this,is,a,test | echo -a $regex(%a,/this,is/)
will NOT work. As commas are the parameter separators in identifiers, they shouldn't be used directly inside parameters: they have to be escaped. In regex, you can use \x2C, but generally you can use $chr(44). For example:
Code:
//echo -a $upper($+(this,$chr(44),is))


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#60888 18/11/03 09:06 AM
Joined: Nov 2003
Posts: 2
K
Kester Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
K
Joined: Nov 2003
Posts: 2
tnx, that was the problem indeed, i didn't know that the comma should be escaped in the regular expression itself

#60889 01/12/03 11:07 AM
Joined: Feb 2003
Posts: 810
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Feb 2003
Posts: 810
Also remember that the expression itself could be in a %variable as well, so you could use $regex(%a,%b) too.


* cold edits his posts 24/7

Link Copied to Clipboard