mIRC Home    About    Download    Register    News    Help

Print Thread
How to grab everything within ( ) ? #181009 16/07/07 03:07 PM
Joined: Mar 2005
Posts: 39
B
bapplander Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Mar 2005
Posts: 39
Hi, how can I grab everything thats inside ( here ) ?
like %stuff = <code>

Re: How to grab everything within ( ) ? [Re: bapplander] #181011 16/07/07 03:10 PM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,876
Code:
var %stuff = ( here )
%stuff = $mid(%stuff,2,-1)

Re: How to grab everything within ( ) ? [Re: hixxy] #181021 16/07/07 06:14 PM
Joined: Dec 2002
Posts: 271
N
NightChillz Offline
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 271
//var %stuff = (stuff inside brackets) blah blah (more stuff) blah (and even more stuff here) how about (this is the final sstuff), %matches = $regex(%stuff,/\((.*?)\)/gi), %cur = 1 | while (%cur <= %matches) { echo -a match# $+ %cur $+ : $regml(%cur) | inc %cur }


key parts being:


$regex(%stuff,/\((.*?)\)/gi)

and

$regml(N) to get the Nth match for items found within ( and )