mIRC Home    About    Download    Register    News    Help

Print Thread
#244395 23/02/14 06:36 PM
Joined: Dec 2010
Posts: 89
D
Babel fish
OP Offline
Babel fish
D
Joined: Dec 2010
Posts: 89
I have a socket, getting information from a web page, and it's listing some information I want with <b> tags by the looks of things
Quote:
<center>Statistics for Account Test</center><br> <b><font color='orange'>Admin</font><img src='/img/1.gif'><font color='orange'> - Admin Level 5</font></b><br><b>

In aline, it's displaying it all in one line, and there is no spaces between the information.
Quote:
Statistics for Account Test Admin - Admin Level 5Banned- no

(Im using a script which automatically removes HTML, i found from the internet).
How can I make the stuff display properly, so for example, it should display like this in the aline box
Quote:
Statistics for Account Test
Admin - Admin level 5
Banned- no



current code:
Quote:
aline 5 @AccountCheck - $noHTML(%read)

Quote:
alias noHTML return $regsubex($1, /<[^>]+(?:>|$)|^[^<>]+>/g, $null)

Last edited by dominic_eddy; 23/02/14 06:38 PM.
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Code:
alias innertext {
  return $regex($2,$$1-,/>([^>]+?)<\//g)
}

alias test {
  var %text = <center>Statistics for Account Test</center><br>	 <b><font color='orange'>Admin</font><img src='/img/1.gif'><font color='orange'> - Admin Level 5</font></b><br><b>
  var %i = 1, %matches = $innertext(%text)
  while (%i <= %matches) {
    echo -ag $regml(%i)
    inc %i
  }
}

Joined: Dec 2010
Posts: 89
D
Babel fish
OP Offline
Babel fish
D
Joined: Dec 2010
Posts: 89
Thanks loki! this works great laugh although one problem. I put it into my script and each time i run it, it displays this error message once.
/echo: insufficient parameters (line 1154, GXAC2.txt)

Dunno who shocked It still displays everything perfectly. Anyway i can hide this error?

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
It's probably trying to print whitespace, I've altered the regex such that at least one non-whitespace character must be present to match.

Code:
alias innertext {
  return $regex($2,$$1-,/>(\s*(?:[^>\s]+?\s*)+)<\//g)
}

Joined: Dec 2010
Posts: 89
D
Babel fish
OP Offline
Babel fish
D
Joined: Dec 2010
Posts: 89
Thanks again! =] works great


Link Copied to Clipboard