mIRC Home    About    Download    Register    News    Help

Print Thread
#38090 23/07/03 08:07 PM
Joined: Jul 2003
Posts: 3
1
1ns1d3 Offline OP
Self-satisified door
OP Offline
Self-satisified door
1
Joined: Jul 2003
Posts: 3
Hello! I'm new in mIRC scripting, and I've got a question.

I've got a string - here it is

<span class=txt2>Statistics for: Sunday 14.6.2003 - Friday 18.7.2003<br>For last 35 days channel has been visited 537 people</span><br><br>

I have to get from this string string, looked like this Statistics for: Sunday 14.6.2003 - Friday 18.7.2003

Now, i'm using this alias:
Code:
 htmlfree {
  ; It's local because it won't be used by the command line, only this file.
  ; Local aliases avoid conflicting names.
  var %x, %i = $regsub($1-,/(^[^&lt;]*&gt;|&lt;[^&gt;]*&gt;|&lt;[^&gt;]*$)/g,$null,%x), %x = $remove(%x,&amp;nbsp;)
  return %x
} 


BUT - it returns not the string i need. It just removes all HTML tags. But, it shoul remove second part. It returs string Statistics for: Sunday 14.6.2003 - Friday 18.7.2003For last 35 days channel has been visited 537 people, but i need it to return Statistics for: Sunday 14.6.2003 - Friday 18.7.2003

Can someone help me?

P.S. Sorry for my English - I'm learnig it few years..

#38091 23/07/03 09:41 PM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Code:

alias blerg {
  !.echo -q $regex($1-,/&gt;(.*)&lt;br&gt;(.*)&lt;//)
  return $regml(1)
}


//echo -a * $blerg(<span class=txt2>Statistics for: Sunday 14.6.2003 - Friday 18.7.2003<br>For last 35 days channel has been visited 537 people</span><br><br>)

* Statistics for: Sunday 14.6.2003 - Friday 18.7.2003


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#38092 23/07/03 09:56 PM
Joined: Jul 2003
Posts: 3
1
1ns1d3 Offline OP
Self-satisified door
OP Offline
Self-satisified door
1
Joined: Jul 2003
Posts: 3
Oh thx a lot dude! Everyhing works!

How do you know this? Perhaps you know some FAQ links? I tried to search, but 'bout functions as $regex there is nothing =(

#38093 23/07/03 11:03 PM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
Perl regular expressions man page
This is the mac-daddy site, but much of it does not apply directly to mIRC's implementation of regular expressions. However, it's as near to the bible of perl regular expressions as you can find online that I know of.

Perl Compatible Regular Expressions (PCRE)
mIRC uses an implementation of regex called PCRE (which has been ported over to the Windows platform) which was written by Philip Hazel and copyrighted by Cambridge University, UK. Currently in version 4.3 (21-May-03), though mIRC uses the version that was out when 6.03 came out which would have been version 3.9.

PHP Manual - LXXXVIII. Regular Expression Functions (Perl-Compatible)
Among many other familiar things, PHP uses the PCRE implementation of regular expressions. While these pages are not directly applicable to mIRC as is, they do have lots of good examples and discussion of different regex patterns you might use yourself (or learn from) and use the same implementation of regex as mIRC.

Regular expressions are difficult to start learning, stressful to work with, and can also be great fun to work out (once you've done finally gotten it right). The key is practice, practice and .. oh, did I mention practice?

Basic $regex
This is a class I gave on basic regex. It is intended as only a brief overview of what regex is and what it's not. It starts with what wildcards are ... and what they're not, what they can't do that regex can.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#38094 24/07/03 02:07 PM
Joined: Jul 2003
Posts: 3
1
1ns1d3 Offline OP
Self-satisified door
OP Offline
Self-satisified door
1
Joined: Jul 2003
Posts: 3
Thanks!

#38095 25/07/03 07:29 AM
Joined: Jul 2003
Posts: 9
C
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
C
Joined: Jul 2003
Posts: 9
next time, thank Jagfire for that regex... ktnx mad


Link Copied to Clipboard