mIRC Homepage
Posted By: pouncer regex problem - 01/06/07 12:01 AM
Code:
alias testing {
  var %data = <td valign=middle align=left nowrap><a href="somelink" class="rmlist" >Chat Cafe</a></td><td>some topic here</td><td style="text-align: right">5</td><td>Dutch</td>

  if ($regex(%data, class=\"rmlist\" \>(.*)\<\/a\>)) {
    echo -a $regml(1)
  }
}


It echos the roomname - Chat Cafe. Fine..
But how can i get the room topic within $regml(2) ?
some topic here
the problem is how do i search up until the next </td> ?
Posted By: starbucks_mafia Re: regex problem - 01/06/07 01:03 AM
Code:
alias testing {
  var %data = <td valign=middle align=left nowrap><a href="somelink" class="rmlist" >Chat Cafe</a></td><td>some topic here</td><td style="text-align: right">5</td><td>Dutch</td>

  if ($regex(%data, class=\"rmlist\" \>(.*)\<\/a\>.*?\<td\b[^>]*\>(.*?)\<\/td\>)) {
    echo -a $regml(1)
    echo -a $regml(2)
  }
}
Posted By: pouncer Re: regex problem - 01/06/07 05:48 PM
thanks starbuk that is perfect! i tried to extend it to get the number too:

Code:
if ($regex(%read, class=\"rmlist\" \>(.*)\<\/a\>.*?\<td\b[^>]*\>(.*?)\<\/td\>.*?right\"\b[^>]*\>(.*)\<\/td\>)) {
}


but i think i messed it up, it doesnt echo anything
and also, what is the diffetent between (.*) and (.*?)
© mIRC Discussion Forums