mIRC Home    About    Download    Register    News    Help

Print Thread
$regex result #169900 30/01/07 02:43 PM
Joined: Dec 2006
Posts: 31
K
klaaamp Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Dec 2006
Posts: 31
If I use $regex, can I output what it grabbed instead of 1 or 0?

Re: $regex result [Re: klaaamp] #169903 30/01/07 03:13 PM
Joined: Oct 2005
Posts: 1,741
G
genius_at_work Offline
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
/help $regml

-genius_at_work

Re: $regex result [Re: klaaamp] #169918 30/01/07 10:43 PM
Joined: Oct 2006
Posts: 166
B
b1ink Offline
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2006
Posts: 166
Group the pattern which matches your wishes result "()" then use $regml(N) N refers to the Nth result.


Kind Regards, blink
Re: $regex result [Re: b1ink] #169956 31/01/07 09:06 AM
Joined: Dec 2006
Posts: 31
K
klaaamp Offline OP
Ameglian cow
OP Offline
Ameglian cow
K
Joined: Dec 2006
Posts: 31
I tried with var %regml = $regex(%var1,\d\d\d\d) | set %year $regml(1) but %year is just blank smirk whats wrong?

Re: $regex result [Re: klaaamp] #169957 31/01/07 10:55 AM
Joined: Oct 2006
Posts: 166
B
b1ink Offline
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2006
Posts: 166
Regex Grouping read this for more info.
As for your example you didn't group your pattern as below:
$regex(%var1,(\d\d\d\d))


Kind Regards, blink
Re: $regex result [Re: klaaamp] #169958 31/01/07 10:56 AM
Joined: Oct 2006
Posts: 166
B
b1ink Offline
Vogon poet
Offline
Vogon poet
B
Joined: Oct 2006
Posts: 166
Also enclose your pattern with // so it would make it easy for you to use the modifiers.


Kind Regards, blink