mIRC Home    About    Download    Register    News    Help

Print Thread
regex problem #177838 01/06/07 12:01 AM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
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> ?

Re: regex problem [Re: pouncer] #177845 01/06/07 01:03 AM
Joined: Dec 2002
Posts: 2,962
S
starbucks_mafia Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
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)
  }
}


Spelling mistakes, grammatical errors, and stupid comments are intentional.
Re: regex problem [Re: starbucks_mafia] #177880 01/06/07 05:48 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
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 (.*?)

Last edited by pouncer; 01/06/07 06:00 PM.