mIRC Home    About    Download    Register    News    Help

Print Thread
#158271 02/09/06 10:19 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
basically im parsing through the socket data,

and the line im looking for is like this

Set-Cookie: userrole=354545454354; expires=whenever blah blah

can anyone show me how to capture the userrole effeciently using regex guys? my socket is like this

Code:
on *:sockread:cookie: {
  var %read
  sockread %read 
  tokenize 32 %read

 //need to get userrole
}

#158272 03/09/06 12:39 AM
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
Code:
if ($regex($1-,/userrole=(\d+)/[color:red]i[/color])) {
  ; $regml(1) = the captured number
}


remove i for case sensitivity smile

Last edited by jaytea; 03/09/06 12:40 AM.

"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
#158273 03/09/06 12:46 AM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
thanks jaytea it almost worked but i got a prob

say the userrole is 54270%40%40621E88A505R48H95845H62V756E12Y44760I78J388Z46E77

your code only echos 54270 hmm

#158274 03/09/06 12:47 AM
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
ah, then change it to:

Code:
if ($regex($1-,/userrole=(.+?);/[color:red]i[/color])) {
  ; $regml(1) = the captured userrole
}


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
#158275 03/09/06 01:24 AM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
awesome thanks


Link Copied to Clipboard