mIRC Homepage
Posted By: pouncer regex help for strings - 02/09/06 10:19 PM
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
}
Posted By: jaytea Re: regex help for strings - 03/09/06 12:39 AM
Code:
if ($regex($1-,/userrole=(\d+)/[color:red]i[/color])) {
  ; $regml(1) = the captured number
}


remove i for case sensitivity smile
Posted By: pouncer Re: regex help for strings - 03/09/06 12:46 AM
thanks jaytea it almost worked but i got a prob

say the userrole is 54270%40%40621E88A505R48H95845H62V756E12Y44760I78J388Z46E77

your code only echos 54270 hmm
Posted By: jaytea Re: regex help for strings - 03/09/06 12:47 AM
ah, then change it to:

Code:
if ($regex($1-,/userrole=(.+?);/[color:red]i[/color])) {
  ; $regml(1) = the captured userrole
}
Posted By: pouncer Re: regex help for strings - 03/09/06 01:24 AM
awesome thanks
© mIRC Discussion Forums